Skip to content

Commit ce0291b

Browse files
Added wait function
1 parent bd69b97 commit ce0291b

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

plugins/acp/acp_plugin_gamesdk/acp_plugin.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from dataclasses import dataclass, asdict
77
from datetime import datetime
88
import traceback
9+
import time
910

1011
import socketio
1112
import socketio.client
@@ -626,3 +627,25 @@ def _deliver_job_executable(self, jobId: int, deliverableType: str, deliverable:
626627
except Exception as e:
627628
print(traceback.format_exc())
628629
return FunctionResultStatus.FAILED, f"System error while delivering items - try again after a short delay. {str(e)}", {}
630+
631+
@property
632+
def wait(self) -> Function:
633+
634+
wait_duration_arg = Argument(
635+
name="waitDuration",
636+
type="integer",
637+
description="The duration to wait in seconds (minimum 30 seconds)",
638+
)
639+
640+
return Function(
641+
fn_name="wait",
642+
fn_description="Waits for a specified amount of time",
643+
args=[wait_duration_arg],
644+
executable=self._wait_executable
645+
)
646+
647+
def _wait_executable(self, waitDuration: int) -> Tuple[FunctionResultStatus, str, dict]:
648+
if waitDuration < 30:
649+
waitDuration = 30
650+
time.sleep(waitDuration)
651+
return FunctionResultStatus.DONE, f"Waited for {waitDuration} seconds", {}

0 commit comments

Comments
 (0)