Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolved error where service status UI was showing all services as blocked #134

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 12 additions & 18 deletions gaseous-server/Timer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private void DoWork(object state)
List<ProcessQueue.QueueItem> ActiveList = new List<ProcessQueue.QueueItem>();
ActiveList.AddRange(ProcessQueue.QueueItems);
foreach (ProcessQueue.QueueItem qi in ActiveList) {
if (CheckProcessBlockList(qi) == true) {
if (CheckIfProcessIsBlockedByOthers(qi) == false) {
qi.BlockedState(false);
if (DateTime.UtcNow > qi.NextRunTime || qi.Force == true)
{
Expand Down Expand Up @@ -69,30 +69,24 @@ public void Dispose()
_timer?.Dispose();
}

private bool CheckProcessBlockList(ProcessQueue.QueueItem queueItem)
private bool CheckIfProcessIsBlockedByOthers(ProcessQueue.QueueItem queueItem)
{
if (queueItem.Blocks.Count > 0)
foreach (ProcessQueue.QueueItem qi in ProcessQueue.QueueItems)
{
foreach (ProcessQueue.QueueItem qi in ProcessQueue.QueueItems)
{
if (qi.ItemState == ProcessQueue.QueueItemState.Running) {
// other service is running, check if queueItem is blocked by it
if (
(
queueItem.Blocks.Contains(qi.ItemType) ||
queueItem.Blocks.Contains(ProcessQueue.QueueItemType.All)
) &&
qi.ItemState == ProcessQueue.QueueItemState.Running
)
qi.Blocks.Contains(queueItem.ItemType) ||
qi.Blocks.Contains(ProcessQueue.QueueItemType.All)
)
{
return false;
Console.WriteLine(queueItem.ItemType.ToString() + " is blocked by " + qi.ItemType.ToString());
return true;
}
}

return true;
}
else
{
return true;
}

return false;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gaseous-server/wwwroot/pages/settings/system.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ <h3>Signatures</h3>

var itemStateName;
var itemLastStart;
if (result[i].IsBlocked == false) {
if (result[i].isBlocked == false) {
switch (result[i].itemState) {
case 'NeverStarted':
itemStateName = "Never started";
Expand Down