Skip to content

Commit 50c7af8

Browse files
authored
Merge pull request #9 from yashsinghcodes/main
fix duplicate execution issue onprem
2 parents 48ad7fc + 8019b65 commit 50c7af8

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

shuffle_sdk/shuffle_sdk.py

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,6 @@ def url_decode(base):
330330
###
331331
###
332332

333-
pastAppExecutions = []
334-
335333
class AppBase:
336334
__version__ = None
337335
app_name = None
@@ -366,21 +364,6 @@ def __init__(self, redis=None, logger=None, console_logger=None):#, docker_clien
366364

367365
# Make start time with milliseconds
368366
self.start_time = int(time.time_ns())
369-
try:
370-
if isinstance(self.action, str):
371-
self.action = json.loads(self.action)
372-
373-
action_id = self.action.get("id")
374-
fullKey = str(self.current_execution_id) + "-" + str(action_id)
375-
if fullKey in pastAppExecutions:
376-
self.logger.error(f"[ERROR] Duplicate execution detected for execution id - {self.current_execution_id} and action - {str(action_id)}")
377-
return
378-
379-
pastAppExecutions.append(fullKey)
380-
if len(pastAppExecutions) > 50:
381-
pastAppExecutions[:] = pastAppExecutions[-50:]
382-
except Exception as e:
383-
self.logger.info(f"[ERROR] Failed to access action ID in the execution({self.current_execution_id}): {e}")
384367

385368
self.init_singul()
386369

@@ -2021,7 +2004,7 @@ def execute_action(self, action):
20212004
self.action = copy.deepcopy(action)
20222005

20232006
headers = {
2024-
"Content-Type": "application/json",
2007+
"Content-Type": "application/json",
20252008
"Authorization": f"Bearer {self.authorization}",
20262009
"User-Agent": "Shuffle 1.1.0",
20272010
}
@@ -4414,10 +4397,11 @@ def execute():
44144397
"success": False,
44154398
"reason": f"Invalid Action data {e}",
44164399
}
4417-
4400+
44184401
# Remaking class for each request
44194402
app = cls(redis=None, logger=logger, console_logger=logger)
44204403
extra_info = ""
4404+
44214405
try:
44224406
#asyncio.run(AppBase.run(action=requestdata), debug=True)
44234407
#value = json.dumps(value)

0 commit comments

Comments
 (0)