Commit d6cb1da2 authored by Costin Grigoras's avatar Costin Grigoras
Browse files

On failures, sleep a bit before retrying; shorter timeout/query

parent 9ac209d5
......@@ -704,7 +704,7 @@ public class TaskQueueUtils {
q = "SELECT status FROM QUEUE where queueId=?;";
db.setReadOnly(true);
db.setQueryTimeout(600);
db.setQueryTimeout(120);
final int queryRetriesMax = 3;
for (int retries = 0;; retries++) {
......@@ -727,6 +727,13 @@ public class TaskQueueUtils {
finally {
limiter.release();
}
try {
Thread.sleep(1000 * (retries + 1) * (retries + 1));
}
catch (@SuppressWarnings("unused") InterruptedException e) {
return false;
}
}
if (!db.moveNext()) {
......@@ -772,7 +779,7 @@ public class TaskQueueUtils {
q = "UPDATE QUEUE SET status=? WHERE queueId=?;";
}
db.setQueryTimeout(600);
db.setQueryTimeout(120);
for (int retries = 0;; retries++) {
try {
......@@ -793,6 +800,13 @@ public class TaskQueueUtils {
finally {
limiter.release();
}
try {
Thread.sleep(1000 * (retries + 1) * (retries + 1));
}
catch (@SuppressWarnings("unused") InterruptedException e) {
return false;
}
}
final boolean updated = db.getUpdateCount() != 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment