Limit library scan workers to four concurrent processes
* Formatting fixes * Library scans are now limited to 4 worker processes
This commit is contained in:
@@ -487,13 +487,15 @@ namespace gaseous_server.Classes
|
||||
|
||||
public void LibraryScan()
|
||||
{
|
||||
int maxWorkers = 4;
|
||||
|
||||
// setup background tasks for each library
|
||||
foreach (GameLibrary.LibraryItem library in GameLibrary.GetLibraries)
|
||||
{
|
||||
Logging.Log(Logging.LogType.Information, "Library Scan", "Starting worker process for library " + library.Name);
|
||||
ProcessQueue.QueueItem queue = new ProcessQueue.QueueItem(
|
||||
ProcessQueue.QueueItemType.LibraryScanWorker,
|
||||
0,
|
||||
1,
|
||||
new List<ProcessQueue.QueueItemType>
|
||||
{
|
||||
ProcessQueue.QueueItemType.OrganiseLibrary,
|
||||
@@ -502,11 +504,34 @@ namespace gaseous_server.Classes
|
||||
false,
|
||||
true);
|
||||
queue.Options = library;
|
||||
queue.ForceExecute();
|
||||
|
||||
ProcessQueue.QueueItems.Add(queue);
|
||||
|
||||
// check number of running tasks is less than maxWorkers
|
||||
bool allowContinue;
|
||||
do
|
||||
{
|
||||
allowContinue = true;
|
||||
int currentWorkerCount = 0;
|
||||
List<ProcessQueue.QueueItem> queueItems = new List<ProcessQueue.QueueItem>();
|
||||
queueItems.AddRange(ProcessQueue.QueueItems);
|
||||
foreach (ProcessQueue.QueueItem item in queueItems)
|
||||
{
|
||||
if (item.ItemType == ProcessQueue.QueueItemType.LibraryScanWorker)
|
||||
{
|
||||
currentWorkerCount += 1;
|
||||
}
|
||||
}
|
||||
if (currentWorkerCount >= maxWorkers)
|
||||
{
|
||||
allowContinue = false;
|
||||
Thread.Sleep(60000);
|
||||
}
|
||||
} while (allowContinue == false);
|
||||
}
|
||||
|
||||
bool WorkersStillWorking = false;
|
||||
bool WorkersStillWorking;
|
||||
do
|
||||
{
|
||||
WorkersStillWorking = false;
|
||||
|
@@ -94,7 +94,14 @@ namespace gaseous_server.Classes.Metadata
|
||||
{
|
||||
if (platformVersion.PlatformLogo != null)
|
||||
{
|
||||
PlatformLogo platformLogo = PlatformLogos.GetPlatformLogo(platformVersion.PlatformLogo.Id, Path.Combine(Config.LibraryConfiguration.LibraryMetadataDirectory_Platform(ParentPlatform), "Versions", platformVersion.Slug));
|
||||
try
|
||||
{
|
||||
PlatformLogo platformLogo = PlatformLogos.GetPlatformLogo(platformVersion.PlatformLogo.Id, Path.Combine(Config.LibraryConfiguration.LibraryMetadataDirectory_Platform(ParentPlatform), "Versions", platformVersion.Slug));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logging.Log(Logging.LogType.Warning, "Platform Update", "Unable to fetch platform logo", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -132,7 +132,14 @@ namespace gaseous_server.Classes.Metadata
|
||||
|
||||
if (platform.PlatformLogo != null)
|
||||
{
|
||||
PlatformLogo platformLogo = PlatformLogos.GetPlatformLogo(platform.PlatformLogo.Id, Config.LibraryConfiguration.LibraryMetadataDirectory_Platform(platform));
|
||||
try
|
||||
{
|
||||
PlatformLogo platformLogo = PlatformLogos.GetPlatformLogo(platform.PlatformLogo.Id, Config.LibraryConfiguration.LibraryMetadataDirectory_Platform(platform));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logging.Log(Logging.LogType.Warning, "Platform Update", "Unable to fetch platform logo", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -106,11 +106,19 @@ namespace gaseous_server.Models
|
||||
long mapId = (long)row["Id"];
|
||||
if (PlatformMapCache.ContainsKey(mapId.ToString()))
|
||||
{
|
||||
platformMaps.Add(PlatformMapCache[mapId.ToString()]);
|
||||
PlatformMapItem mapItem = PlatformMapCache[mapId.ToString()];
|
||||
if (mapItem != null)
|
||||
{
|
||||
platformMaps.Add(mapItem);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
platformMaps.Add(BuildPlatformMapItem(row));
|
||||
PlatformMapItem mapItem = BuildPlatformMapItem(row);
|
||||
if (mapItem != null)
|
||||
{
|
||||
platformMaps.Add(mapItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -52,7 +52,7 @@
|
||||
|
||||
<div id="loginwindow_header_label" style="display: block; text-align: center;">Gaseous Games</div>
|
||||
|
||||
<button type="button" value="Get Started" onclick="document.getElementById('first_welcome').style.display = 'none'; document.getElementById('first_newadmin').style.display = '';" style="margin-top: 50px; width: 100%; font-size: 16px; border-radius: 10px; padding-top: 10px; padding-bottom: 10px;">Get Started</button>
|
||||
<button type="button" value="Get Started" onclick="document.getElementById('first_welcome').style.display = 'none'; document.getElementById('first_newadmin').style.display = '';" class="bigbutton">Get Started</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="loginwindow" id="first_newadmin" style="display: none;">
|
||||
@@ -85,7 +85,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" style="padding-top: 20px;">
|
||||
<button id="login_createaccount" type="button" value="Create Account" onclick="registerAccount();" disabled="disabled" style="margin-top: 10px; width: 100%; font-size: 16px; border-radius: 10px; padding-top: 10px; padding-bottom: 10px;">Create Account</button>
|
||||
<button id="login_createaccount" type="button" value="Create Account" onclick="registerAccount();" disabled="disabled" class="bigbutton">Create Account</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@@ -71,7 +71,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" style="padding-top: 20px;">
|
||||
<button type="button" value="Sign In" onclick="UserLogin();" style="margin-top: 10px; width: 100%; font-size: 16px; border-radius: 10px; padding-top: 10px; padding-bottom: 10px;">Sign In</button>
|
||||
<button type="button" value="Sign In" onclick="UserLogin();" class="bigbutton">Sign In</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@@ -1014,7 +1014,7 @@ div[name="properties_toc_item"]:hover,div[name="properties_user_toc_item"]:hover
|
||||
color: lightgray;
|
||||
}
|
||||
|
||||
button:not(.select2-selection__choice__remove):not(.ejs_menu_button) {
|
||||
button:not(.select2-selection__choice__remove):not(.ejs_menu_button):not(.bigbutton) {
|
||||
background-color: #555;
|
||||
color: white;
|
||||
border-width: 1px;
|
||||
@@ -1035,12 +1035,27 @@ button:not(.select2-selection__choice__remove):not(.ejs_menu_button):hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button:disabled {
|
||||
button:not(.select2-selection__choice__remove):not(.ejs_menu_button):disabled {
|
||||
background-color: #555;
|
||||
color: #888;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.bigbutton {
|
||||
background-color: #555;
|
||||
color: white;
|
||||
border-width: 1px;
|
||||
border-color: #555;
|
||||
border-style: solid;
|
||||
margin-top: 10px;
|
||||
width: 100%;
|
||||
height: 42px;
|
||||
font-size: 16px;
|
||||
border-radius: 10px;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.redbutton {
|
||||
background-color: darkred;
|
||||
border-color: darkred;
|
||||
|
Reference in New Issue
Block a user