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

クローラーを統合したい #914

Open
kenkoooo opened this issue Apr 19, 2021 · 1 comment
Open

クローラーを統合したい #914

kenkoooo opened this issue Apr 19, 2021 · 1 comment

Comments

@kenkoooo
Copy link
Owner

現状では異なる4つのクロール戦略について、それぞれクローラーがあります。

  • crawl_all_submissions
  • crawl_for_virtual_contests
  • crawl_recent_submissions
  • crawl_from_new_contests

ECS でそれぞれについてインスタンスを立てていますが、もし単一の実行可能ファイルでできれば管理が楽になります。

考えているのは message queue を使う方法で、各クローラーは以下のように動きます。

  • クローラーは (クロール戦略, その戦略の状態, クロールするコンテスト, クロールするページ) をキューから受け取る。
  • 1ページクロールする。
  • 状態を更新し、次にクロールするページを取得する。
  • (クロール戦略, 更新したその戦略の状態, 更新したクロールするコンテスト, 更新したクロールするページ) をキューに入れる。
@kenkoooo
Copy link
Owner Author

Redis の LPUSH/BRPOP でジョブキューらしいことができるので、クライアントは Redis のリストから BRPOP し続けて、適当なタイミングで LPUSH するやつが入れば良い感じがします。

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

1 participant