diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2022-06-03 23:30:07 +0200 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2022-06-03 23:30:07 +0200 |
commit | cf9f767c9ab59f5d41a18aa9b22451ef1afb1f9b (patch) | |
tree | 29d494eba4a7e7648d4f35020766964a3017309b | |
parent | 9aff1b63c4ec2128561097536c2ffbe02c0d5a24 (diff) |
jobs: Remove get-result/set-result.
* mumi/jobs.scm (get-result, done?, set-result!): Remove procedures.
(process-next): Do not use set-result!.
-rw-r--r-- | mumi/jobs.scm | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/mumi/jobs.scm b/mumi/jobs.scm index fbec9bb..dfb44f9 100644 --- a/mumi/jobs.scm +++ b/mumi/jobs.scm @@ -63,7 +63,6 @@ (define get-status (make-getter "status")) (define get-options (make-getter "options")) -(define get-result (make-getter "result")) (define (set-status! item status) (set (list (string-append %prefix "status:" item) @@ -74,10 +73,6 @@ (set (list (string-append %prefix "options:" item) (format #f "~s" options)))) -(define (set-result! item result) - (set (list (string-append %prefix "result:" item) - (format #f "~a" result)))) - (define (next-waiting) "Wait for an item to appear on the waiting list, then move it to the processing list and return the name." @@ -95,17 +90,10 @@ the processing list and return the name." (set-options! job-name options))) job-name)) -(define (done? item) - "Return the processing result if the ITEM has been processed or #f -if it has not." - (let ((status (get-status item)) - (result (get-result item))) - (string-prefix? "success" status))) - (define (process-next processor) "Get an item from the waiting queue and run PROCESSOR on it. This procedure blocks until processor exits. Once PROCESSOR exits, -the job status and result are updated." +the job status is updated." (let* ((item (next-waiting)) (options (get-options item))) (with-redis @@ -114,7 +102,6 @@ the job status and result are updated." (let ((result (processor item options))) (with-redis (transaction - (set-result! item result) ;; TODO: store error message in result if job failed (if result (set-status! item "success") |