Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions plugins/acp/acp_plugin_gamesdk/acp_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,10 @@ def _respond_job_executable(self, jobId: int, decision: str, reasoning: str, twe
try:
state = self.get_acp_state()

# Check if job is cancelled
if any(c["jobId"] == jobId for c in state["jobs"]["cancelled"]):
return FunctionResultStatus.FAILED, "Cannot respond - this job has been cancelled", {}

job = next(
(c for c in state["jobs"]["active"]["asASeller"] if c["jobId"] == jobId),
None
Expand Down Expand Up @@ -514,6 +518,10 @@ def _pay_job_executable(self, jobId: int, amount: float, reasoning: str, tweetCo
try:
state = self.get_acp_state()

# Check if job is cancelled
if any(c["jobId"] == jobId for c in state["jobs"]["cancelled"]):
return FunctionResultStatus.FAILED, "Cannot pay - this job has been cancelled", {}

job = next(
(c for c in state["jobs"]["active"]["asABuyer"] if c["jobId"] == jobId),
None
Expand Down Expand Up @@ -607,6 +615,10 @@ def _deliver_job_executable(self, jobId: int, deliverableType: str, deliverable:

try:
state = self.get_acp_state()

# Check if job is cancelled
if any(c["jobId"] == jobId for c in state["jobs"]["cancelled"]):
return FunctionResultStatus.FAILED, "Cannot deliver - this job has been cancelled", {}

job = next(
(c for c in state["jobs"]["active"]["asASeller"] if c["jobId"] == jobId),
Expand Down