-
Notifications
You must be signed in to change notification settings - Fork 9
/
scheduled_jobs.clj
40 lines (34 loc) · 1.06 KB
/
scheduled_jobs.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
(ns goose.api.scheduled-jobs
"API to manage scheduled jobs.\\
- [API wiki](https://github.com/nilenso/goose/wiki/API)"
(:require
[goose.broker :as b]))
(defn size
"Returns count of Scheduled Jobs."
[broker]
(b/scheduled-jobs-size broker))
(defn find-by-id
"Finds a Scheduled Job by `:id`."
[broker id]
(b/scheduled-jobs-find-by-id broker id))
(defn find-by-pattern
"Finds a Scheduled Jobs by user-defined parameters.\\
If limit isn't mentioned, defaults to 10."
([broker match?]
(find-by-pattern broker match? 10))
([broker match? limit]
(b/scheduled-jobs-find-by-pattern broker match? limit)))
(defn prioritise-execution
"Enqueues a Job scheduled to run at anytime to front of queue,
after verification of existence.\\
Hence, this accepts only 1 job instead of multiple."
[broker job]
(b/scheduled-jobs-prioritise-execution broker job))
(defn delete
"Deletes given Scheduled Job."
[broker job]
(b/scheduled-jobs-delete broker job))
(defn purge
"Purges all the Scheduled Jobs."
[broker]
(b/scheduled-jobs-purge broker))