mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Better report to user on push timeout
This commit is contained in:
parent
c435eccc43
commit
a72146aa8d
2 changed files with 11 additions and 3 deletions
|
@ -14,6 +14,8 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||||
*/
|
*/
|
||||||
public class PostbackPromise {
|
public class PostbackPromise {
|
||||||
|
|
||||||
|
private static int TIMEOUT_SECONDS = 60 * 3;
|
||||||
|
|
||||||
private final String postbackKey;
|
private final String postbackKey;
|
||||||
private final ReentrantLock lock;
|
private final ReentrantLock lock;
|
||||||
private final Condition cond;
|
private final Condition cond;
|
||||||
|
@ -35,8 +37,8 @@ public class PostbackPromise {
|
||||||
try {
|
try {
|
||||||
while (!received) {
|
while (!received) {
|
||||||
try {
|
try {
|
||||||
if (!cond.await(60 * 3, TimeUnit.SECONDS)) {
|
if (!cond.await(TIMEOUT_SECONDS, TimeUnit.SECONDS)) {
|
||||||
throw new PostbackTimeoutException();
|
throw new PostbackTimeoutException(TIMEOUT_SECONDS);
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw new InternalErrorException();
|
throw new InternalErrorException();
|
||||||
|
|
|
@ -11,9 +11,15 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public class PostbackTimeoutException extends SevereSnapshotPostException {
|
public class PostbackTimeoutException extends SevereSnapshotPostException {
|
||||||
|
|
||||||
|
private int timeout;
|
||||||
|
|
||||||
|
public PostbackTimeoutException(int timeout) {
|
||||||
|
this.timeout = timeout;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
return "timeout";
|
return "Request timed out (after " + this.timeout + " seconds)";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue