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

core&ui&hydrojudge: allow users to manually sync data #905

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

StupidQu
Copy link

Allow users to manually sync data. Added a button in problem files page.

demo.webm

@StupidQu
Copy link
Author

之前开过一个 PR(#646),但是写的太烂了,最后删了。

packages/hydrojudge/src/hosts/hydro.ts Outdated Show resolved Hide resolved
packages/hydrojudge/src/hosts/hydro.ts Show resolved Hide resolved
packages/ui-default/pages/problem_files.page.tsx Outdated Show resolved Hide resolved
let taskId: string | null = null;
do {
// eslint-disable-next-line no-await-in-loop
taskId = await this.ctx.serial('problem/syncData', this.pdoc.domainId, this.pdoc.docId, this.pdoc.data, doneIds);
Copy link
Member

Choose a reason for hiding this comment

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

serial only iterates listeners on local process, and won't talk to other web processes, emit also the same.
only broadcast will send the event to everyone.

Copy link
Author

Choose a reason for hiding this comment

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

Are there any ways to get all the websocket connections? It seems that using the database is necessary

Copy link
Author

@StupidQu StupidQu Nov 14, 2024

Choose a reason for hiding this comment

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

Is using a new type of document acceptable? Or reuse the information in status collection?

Copy link
Member

Choose a reason for hiding this comment

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

all web servers are intended to be stateless for horizontal scaling;
I'm thinking maybe adding a autoSync: string[] (host/domainId/pid) to judge config file might be a better solution and easily configurable using deployment tools like nix-deploy, ansible, or even system image.
Using server-push means those judges who joined later (scaled up) might get the sync event.

packages/hydrojudge/src/hosts/hydro.ts Show resolved Hide resolved
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