Skip to content

Conversation

@yashsinghcodes
Copy link
Member

No description provided.

Copy link
Member

@frikky frikky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(:

self.start_time = int(time.time_ns())
fullKey = str(self.current_execution_id) + "-" + str(self.action["id"])

if fullKey in pastAppExecutions:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a log here. It's VERY important to know when this happens as to track it at scale.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup Yup

return

pastAppExecutions.append(fullKey)
pastAppExecutions = pastAppExecutions[-50:]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't update every time. Due to the parallel way things run in Flask/Werkzeug it should happen rarely as to not fuck up the threading/concurrency.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, does -50 work when the array is empty? Seems like an out of bounds to me, idk

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup got it and yes -50 works in python, example -
Screenshot 2025-05-13 at 11 18 34 AM


# Make start time with milliseconds
self.start_time = int(time.time_ns())
fullKey = str(self.current_execution_id) + "-" + str(self.action["id"])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you 100% sure "id" ALWAYS exists in self.action? In every scenario?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops! yes you're right let me add some checks and try-expect

@frikky
Copy link
Member

frikky commented May 13, 2025

Tell me when this is ready :))

@yashsinghcodes
Copy link
Member Author

@frikky ready for review :)

Copy link
Member

@frikky frikky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make the print change, then I'll merge :)

action_id = self.action.get("id")
fullKey = str(self.current_execution_id) + "-" + str(action_id)
if fullKey in pastAppExecutions:
self.logger.info(f"[INFO] Duplicate execution detected for execution id - {self.current_execution_id} and action - {self.action["id"]}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest we make this an [ERROR] as it should NEVER EVER occur. That way we can see it easily.

@yashsinghcodes
Copy link
Member Author

Done @frikky 👍

Copy link
Member

@frikky frikky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay edgecases

fullKey = str(self.current_execution_id) + "-" + str(action_id)
if fullKey in pastAppExecutions:
self.logger.info(f"[INFO] Duplicate execution detected for execution id - {self.current_execution_id} and action - {self.action["id"]}")
self.logger.error(f"[ERROR] Duplicate execution detected for execution id - {self.current_execution_id} and action - {self.action["id"]}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more thing:

  • Since you're using action_id above, why do you use self.action["id"] below? self.action.get("id") is safe, but self.action["id"] is not

This may lead to it continuing due to action ID failing to load in the 2nd one 😆

@yashsinghcodes
Copy link
Member Author

Fixed :) @frikky

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants