From cf9f767c9ab59f5d41a18aa9b22451ef1afb1f9b Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Fri, 3 Jun 2022 23:30:07 +0200 Subject: jobs: Remove get-result/set-result. * mumi/jobs.scm (get-result, done?, set-result!): Remove procedures. (process-next): Do not use set-result!. --- mumi/jobs.scm | 15 +-------------- 1 file changed, 1 insertion(+), 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") -- cgit v1.2.3