Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Die Standardbibliotheksys.sleep sperrt die Ausführung für die angegebene Anzahl von Sekunden bis zu maximal 31536000 (ein Jahr).
Workflow anhalten
Sie können die Ausführung eines Workflows anhalten, indem Sie der Definition Ihres Workflows einen Ruhemodusschritt hinzufügen. Dieser Schritt enthält einen Aufruf von sys.sleep und gibt in Sekunden an, wie lange der Workflow pausiert werden soll:
Sie können auch sys.sleep verwenden, um Daten in einem bestimmten Intervall abzufragen. Sie können beispielsweise eine API abfragen, bis eine bestimmte Bedingung erfüllt ist:
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[],[],null,["# Wait using polling\n\nThe `sys.sleep` [standard library function](/workflows/docs/reference/stdlib/sys/sleep)\nsuspends execution for the given number of seconds to a maximum of 31536000 (one\nyear).\n\nPause a workflow\n----------------\n\nYou can pause the execution of a workflow by adding a sleep step to your\nworkflow's definition. This step includes a call to `sys.sleep` and specifies in\nseconds how long you want to pause the workflow: \n\n### YAML\n\n```yaml\n - STEP_NAME:\n call: sys.sleep\n args:\n seconds: SLEEP_IN_SECONDS\n \n```\n\n### JSON\n\n```json\n [\n {\n \"\u003cvar translate=\"no\"\u003eSTEP_NAME\u003c/var\u003e\": {\n \"call\": \"sys.sleep\",\n \"args\": {\n \"seconds\": \"\u003cvar translate=\"no\"\u003eSLEEP_IN_SECONDS\u003c/var\u003e\"\n }\n }\n }\n ]\n \n```\n\nPoll for data\n-------------\n\nYou can also use `sys.sleep` to poll for data over a given interval. For example,\nyou might want to poll an API until a specific condition is met: \n\n### YAML\n\n```yaml\n main:\n params: [jobId]\n steps:\n - checkJob:\n call: http.get\n args:\n url: ${\"https://example.com/jobs/\" + jobId}\n auth:\n type: OAuth2\n result: jobStatus\n - checkIfDone:\n switch:\n - condition: ${jobStatus.complete}\n return: ${jobStatus}\n - wait:\n call: sys.sleep\n args:\n seconds: 60\n next: checkJob\n \n```\n\n### JSON\n\n```json\n {\n \"main\": {\n \"params\": [\n \"jobId\"\n ],\n \"steps\": [\n {\n \"checkJob\": {\n \"call\": \"http.get\",\n \"args\": {\n \"url\": \"${\\\"https://example.com/jobs/\\\" + jobId}\",\n \"auth\": {\n \"type\": \"OAuth2\"\n }\n },\n \"result\": \"jobStatus\"\n }\n },\n {\n \"checkIfDone\": {\n \"switch\": [\n {\n \"condition\": \"${jobStatus.complete}\",\n \"return\": \"${jobStatus}\"\n }\n ]\n }\n },\n {\n \"wait\": {\n \"call\": \"sys.sleep\",\n \"args\": {\n \"seconds\": 60\n },\n \"next\": \"checkJob\"\n }\n }\n ]\n }\n }\n \n```"]]