Updated task structure to use a JSON string instead of seq[string], making it possible to use multiple differently typed arguments

This commit is contained in:
Jakob Friedl
2025-07-09 14:38:30 +02:00
parent 71ff092975
commit bb56ed42f2
10 changed files with 124 additions and 73 deletions

View File

@@ -1,13 +1,16 @@
import os, strutils, strformat, base64
import os, strutils, strformat, base64, json
import ../types
proc taskSleep*(task: Task): TaskResult =
echo fmt"Sleeping for {task.args[0]} seconds."
# Parse task parameter
let delay = parseJson(task.args)["delay"].getInt()
echo fmt"Sleeping for {delay} seconds."
try:
sleep(parseInt(task.args[0]) * 1000)
sleep(delay * 1000)
return TaskResult(
task: task.id,
agent: task.agent,