diff --git a/src/apatheia/jobs.nim b/src/apatheia/jobs.nim index 1e07e88..23675a7 100644 --- a/src/apatheia/jobs.nim +++ b/src/apatheia/jobs.nim @@ -9,6 +9,7 @@ import chronos import chronicles export queues +export chronicles logScope: # Lexical properties are typically assigned to a constant: @@ -40,16 +41,18 @@ proc processJobs*[T](jobs: JobQueue[T]) {.async.} = ## This processor waits for events from the queue in the JobQueue ## and complete the associated futures. + const tn: string = $(JobQueue[T]) + info "Processing jobs in job queue for type ", type=tn while jobs.running: - info "Processing jobs in job queue" let res = await(jobs.queue.wait()).get() - debug "got job result", jobResult = res + trace "got job result", jobResult = $res let (id, ret) = res var fut: Future[T] if jobs.futures.pop(id, fut): fut.complete(ret) else: raise newException(IndexDefect, "missing future: " & $id) + info "Processing jobs in job queue" proc createFuture*[T](jobs: JobQueue[T], name: static string): (JobResult[T], Future[T]) = let fut = newFuture[T](name) diff --git a/tests/ttasks.nim b/tests/ttasks.nim index aa86609..a004f2b 100644 --- a/tests/ttasks.nim +++ b/tests/ttasks.nim @@ -13,7 +13,7 @@ import apatheia/tasks proc addNums(a, b: float): float {.asyncTask.} = os.sleep(100) - echo "adding: ", a, " + ", b + # info "adding: ", a=a, b=b return a + b proc addNumValues(vals: openArray[float]): float {.asyncTask.} = @@ -21,7 +21,7 @@ proc addNumValues(vals: openArray[float]): float {.asyncTask.} = result = 0.0 for x in vals: result += x - echo "adding sums: ", vals + # echo "adding sums: ", vals suite "async tests": var tp = Taskpool.new(num_threads = 2) # Default to the number of hardware threads.