Background Jobs
Qualified Name | Type |
---|---|
apoc.periodic.list |
|
apoc.periodic.submit |
|
apoc.periodic.countdown |
|
-
The jobs list is updated every 10s for finished jobs.
Additional configuration
Many procedures run in the background or asynchronously. The following setting overrides the default thread pool size (processors*2):
apoc.jobs.pool.num_threads=10
Many periodic procedures rely on a scheduled executor that has a pool of threads with a default fixed size (processors/4, at least 1). To configure the pool size, use the following configuration property:
apoc.jobs.scheduled.num_threads=10
Countdown Example
This statement repeats until the termination is reached. The statement must return a numeric value and it should decrement (similar to a monotonically decreasing function). When the return value reaches 0 the iteration stops.
For example, to define a counter with a numeric property, use the following command:
CREATE (counter:Counter) SET counter.c = 10
To decrement this property by 1 each second, use the following command:
CALL apoc.periodic.countdown('decrement',"MATCH (counter:Counter) SET counter.c = counter.c - 1 RETURN counter.c as count", 1)