Gitlab Community Edition Instance

Commit 26402201 authored by mhellka's avatar mhellka
Browse files

Rollback large explicit transactions in background.

Client usually does not care about a transaction after rollback
parent 356de2d0
......@@ -2,9 +2,9 @@ package de.gwdg.cdstar.rest.v3;
import java.time.Duration;
import de.gwdg.cdstar.rest.api.RestBlueprint;
import de.gwdg.cdstar.rest.api.RestConfig;
import de.gwdg.cdstar.rest.api.RestContext;
import de.gwdg.cdstar.rest.api.RestBlueprint;
import de.gwdg.cdstar.rest.utils.QueryHelper;
import de.gwdg.cdstar.rest.utils.SessionHelper;
import de.gwdg.cdstar.rest.v3.async.ModelHelper;
......@@ -64,7 +64,8 @@ public class TransactionEndpoint implements RestBlueprint {
}
public Void handleDelete(RestContext ctx) throws Exception {
getTxOr404(ctx).rollback();
CDStarSession tx = getTxOr404(ctx);
ctx.runInPool(tx::rollback); // Close in background
ctx.status(204);
return null;
}
......@@ -75,7 +76,7 @@ public class TransactionEndpoint implements RestBlueprint {
throw new ErrorResponse(404, "TransactonNotFound", "No transaction specified");
final CDStarSession session = ctx.getService(CDStarRuntime.class).resumeSession(txid);
if (session == null)
if (session == null || session.isExpired())
throw new ErrorResponse(404, "TransactonNotFound", "Unknown or expired transaction").detail("transaction",
txid);
return session;
......
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