Skip to content

Commit 96e9350

Browse files
committed
remove commented out sleep
1 parent b68d832 commit 96e9350

1 file changed

Lines changed: 1 addition & 57 deletions

File tree

src/main/java/dev/dbos/transact/database/NotificationsDAO.java

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -226,63 +226,7 @@ public Object recv(String workflowUuid, int functionId, int timeoutFunctionId,
226226
}
227227
}
228228
}
229-
230-
// TODO : can be moved elsewhere when we implement DBOS.sleep
231-
/* public double sleep(String workflowUuid, int functionId, double seconds, boolean skipSleep) throws SQLException {
232-
String functionName = "DBOS.sleep";
233-
234-
StepResult recordedOutput = null ;
235-
236-
try (Connection c = dataSource.getConnection()) {
237-
recordedOutput = stepsDAO.checkStepExecutionTxn(workflowUuid, functionId, functionName, c) ;
238-
}
239-
240-
Double endTime;
241-
if (recordedOutput != null) {
242-
logger.debug("Replaying sleep, id: {}, seconds: {}", functionId, seconds);
243-
String output = recordedOutput.getOutput();
244-
if (output == null) {
245-
throw new AssertionError("no recorded end time");
246-
}
247-
endTime = (Double)JSONUtil.deserializeToArray(output)[0] ;
248-
} else {
249-
logger.debug("Running sleep, id: {}, seconds: {}", functionId, seconds);
250-
endTime = System.currentTimeMillis() / 1000.0 + seconds;
251-
252-
try {
253-
254-
StepResult output = new StepResult();
255-
output.setWorkflowId(workflowUuid);
256-
output.setFunctionId(functionId);
257-
output.setFunctionName(functionName);
258-
output.setOutput(JSONUtil.serialize(endTime));
259-
output.setError(null);
260-
261-
try(Connection conn = dataSource.getConnection()) {
262-
stepsDAO.recordStepResultTxn(output, conn);
263-
}
264-
} catch (DBOSWorkflowConflictException e) {
265-
// Ignore conflict - operation already recorded
266-
logger.error("Error recording sleep error ",e);
267-
}
268-
}
269-
270-
double duration = Math.max(0, endTime - (System.currentTimeMillis() / 1000.0));
271-
272-
if (!skipSleep) {
273-
try {
274-
Thread.sleep((long) (duration * 1000));
275-
} catch (InterruptedException e) {
276-
Thread.currentThread().interrupt();
277-
throw new RuntimeException("Sleep interrupted", e);
278-
}
279-
}
280-
281-
return duration;
282-
}
283-
284-
*/
285-
229+
286230
public void setEvent(String workflowId, int functionId, String key, Object message) throws SQLException {
287231
String functionName = "DBOS.setEvent";
288232

0 commit comments

Comments
 (0)