Skip to content

Commit

Permalink
[NOID] Update param name to delay (#488)
Browse files Browse the repository at this point in the history
  • Loading branch information
gem-neo4j authored Oct 24, 2023
1 parent 7fd644b commit 0c37a5e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions core/src/main/java/apoc/periodic/Periodic.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@ private void validateQuery(String statement) {

@Procedure(name = "apoc.periodic.countdown", mode = Mode.WRITE)
@Description("Runs a repeatedly called background statement until it returns 0.")
public Stream<JobInfo> countdown(@Name("name") String name, @Name("statement") String statement, @Name("rate") long rate) {
public Stream<JobInfo> countdown(@Name("name") String name, @Name("statement") String statement, @Name("delay") long delay) {
validateQuery(statement);
JobInfo info = submitJob(name, new Countdown(name, statement, rate, log), log, pools);
info.rate = rate;
JobInfo info = submitJob(name, new Countdown(name, statement, delay, log), log, pools);
info.delay = delay;
return Stream.of(info);
}

Expand Down Expand Up @@ -304,20 +304,20 @@ private static String prependQueryOption(String query, String cypherOption) {
private class Countdown implements Runnable {
private final String name;
private final String statement;
private final long rate;
private final long delay;
private transient final Log log;

public Countdown(String name, String statement, long rate, Log log) {
public Countdown(String name, String statement, long delay, Log log) {
this.name = name;
this.statement = statement;
this.rate = rate;
this.delay = delay;
this.log = log;
}

@Override
public void run() {
if (Periodic.this.executeNumericResultStatement(statement, Collections.emptyMap()) > 0) {
pools.getScheduledExecutorService().schedule(() -> submitJob(name, this, log, pools), rate, TimeUnit.SECONDS);
pools.getScheduledExecutorService().schedule(() -> submitJob(name, this, log, pools), delay, TimeUnit.SECONDS);
}
}
}
Expand Down

0 comments on commit 0c37a5e

Please sign in to comment.