Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest watchdog would trigger on_opened events #1129

Closed
cuom1999 opened this issue Apr 6, 2023 · 2 comments
Closed

Latest watchdog would trigger on_opened events #1129

cuom1999 opened this issue Apr 6, 2023 · 2 comments

Comments

@cuom1999
Copy link
Contributor

cuom1999 commented Apr 6, 2023

Latest commit from watchdog: gorakhargosh/watchdog@f3dfc4b

It means SendProblemsHandler.on_any_event in monitor.py would also trigger on_opened. Judges need to trigger this to read test data and init file. This leads to supported-problems being sent multiple times on every submission. Suppose there are n judges, bridged will receive at least 2 * n supported-problems packets on each submission, which leads to 2n SQL update queries.

One simple fix is to add this line in SendProblemsHandler.on_any_event.

def on_any_event(self, event):
        if event.event_type == "opened":
            return
        if self.callback is not None:
            self.callback()
        if self.refresher is not None:
            self.refresher.refresh()
@Xyene
Copy link
Member

Xyene commented Apr 9, 2023

That sounds reasonable, but I think rather than comparing against opened and bailing, we should compare against the set of events we do care about (in case watchdog adds more events in the future)

Would you be willing to submit a patch?

@Xyene
Copy link
Member

Xyene commented Apr 21, 2023

Fixed in 17b0bcf.

@Xyene Xyene closed this as completed Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants