Fixed unnecessary database transactions when consumer is empty (fixes #511)
This commit is contained in:
parent
3b9d8726d9
commit
e61b8a4d9b
1 changed files with 9 additions and 0 deletions
|
|
@ -83,6 +83,14 @@ public class Process {
|
||||||
int consumerDataSize = consumerData.size();
|
int consumerDataSize = consumerData.size();
|
||||||
currentConsumerSize = consumerDataSize;
|
currentConsumerSize = consumerDataSize;
|
||||||
|
|
||||||
|
if (currentConsumerSize == 0) { // No data, skip processing
|
||||||
|
updateLockTable(statement, (lastRun ? 0 : 1));
|
||||||
|
statement.close();
|
||||||
|
Consumer.consumer_id.put(processId, new Integer[] { 0, 0 });
|
||||||
|
Consumer.isPaused = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Database.beginTransaction(statement);
|
Database.beginTransaction(statement);
|
||||||
// Scan through usernames, ensure everything is loaded in memory.
|
// Scan through usernames, ensure everything is loaded in memory.
|
||||||
for (Entry<Integer, String[]> entry : users.entrySet()) {
|
for (Entry<Integer, String[]> entry : users.entrySet()) {
|
||||||
|
|
@ -225,6 +233,7 @@ public class Process {
|
||||||
consumerData.remove(index);
|
consumerData.remove(index);
|
||||||
}
|
}
|
||||||
currentConsumerSize = 0;
|
currentConsumerSize = 0;
|
||||||
|
Consumer.consumer_id.put(processId, new Integer[] { 0, 0 });
|
||||||
Consumer.isPaused = false;
|
Consumer.isPaused = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue