Skip batches on session change

This commit is contained in:
M66B 2020-09-21 13:34:44 +02:00
parent c77ec0bd10
commit d5e1cf1ae1
1 changed files with 8 additions and 3 deletions

View File

@ -162,7 +162,7 @@ class Core {
Log.i(folder.name + " executing operations=" + ops.size());
while (retry < LOCAL_RETRY_MAX && ops.size() > 0 &&
state.isRunning() &&
state.batchCanRun(folder.id, priority, sequence)) {
state.batchCanRun(session, folder.id, priority, sequence)) {
TupleOperationEx op = ops.get(0);
try {
@ -500,7 +500,9 @@ class Core {
ops.remove(op);
} else {
retry++;
if (retry < LOCAL_RETRY_MAX)
if (retry < LOCAL_RETRY_MAX &&
state.isRunning() &&
state.batchCanRun(session, folder.id, priority, sequence))
try {
Thread.sleep(LOCAL_RETRY_DELAY);
} catch (InterruptedException ex1) {
@ -4251,7 +4253,10 @@ class Core {
}
}
boolean batchCanRun(long folder, int priority, long current) {
boolean batchCanRun(int session, long folder, int priority, long current) {
if (!this.active || session != this.session)
return false;
synchronized (this) {
FolderPriority key = new FolderPriority(folder, priority);
boolean can = batch.get(key).equals(current);