Skip to content

Commit

Permalink
don't kill queues waiting on nothing
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jan 1, 2023
1 parent cf2a93a commit 8281d9a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Expand Up @@ -295,7 +295,7 @@ public final TimedQueue forceToTimed(TimedQueue.DelayTracker delay) {
newQueue.script = script;
newQueue.holdingOn = holdingOn;
newQueue.callBack(r);
if (newQueue.script_entries.isEmpty()) {
if (newQueue.script_entries.isEmpty() && newQueue.holdingOn == null) {
newQueue.stop();
}
else {
Expand All @@ -322,7 +322,7 @@ public final void start(boolean doBasicConfig) {
if (is_started) {
return;
}
if (script_entries.isEmpty()) {
if (script_entries.isEmpty() && holdingOn == null) {
return;
}
if (CoreConfiguration.verifyThreadMatches && !DenizenCore.isMainThread()) {
Expand Down Expand Up @@ -418,6 +418,9 @@ public final void stop() {

public final void setLastEntryExecuted(ScriptEntry entry) {
lastEntryExecuted = entry;
if (entry != null) {
entry.queue = this;
}
}

public final ScriptEntry getNext() {
Expand Down
Expand Up @@ -12,7 +12,7 @@ public InstantQueue(String id) {
@Override
public void onStart() {
while (is_started) {
if (script_entries.isEmpty()) {
if (script_entries.isEmpty() && holdingOn == null) {
stop();
return;
}
Expand Down
Expand Up @@ -105,7 +105,7 @@ public TimedQueue setSpeed(long ticks) {
@Override
public void onStart() {
revolve();
if (script_entries.isEmpty()) {
if (script_entries.isEmpty() && holdingOn == null) {
return;
}
DenizenCore.timedQueues.add(this);
Expand All @@ -127,7 +127,7 @@ public final void tryRevolveOnce() {
}

public void revolve() {
if (script_entries.isEmpty()) {
if (script_entries.isEmpty() && holdingOn == null) {
if (!waitWhenEmpty) {
stop();
}
Expand All @@ -137,7 +137,7 @@ public void revolve() {
return;
}
ScriptEngine.revolve(this);
if (script_entries.isEmpty() && !waitWhenEmpty) {
if (script_entries.isEmpty() && holdingOn == null && !waitWhenEmpty) {
stop();
}
}
Expand Down

0 comments on commit 8281d9a

Please sign in to comment.