Блог пользователя shakil.ahamed

Автор shakil.ahamed, история, 7 лет назад, По-английски

I planned to write an tempermonkey script for codeforces, that will help me copying multi-test inputs. But As i didn't write javascript for years, I wanted to make use of the chrome console.

Here is a screenshot!

Screenshot

The script codeforces.js is pinging to some server and flooding the debug console. Is it intended or done by mistake? It makes my job harder :(

  • Проголосовать: нравится
  • +38
  • Проголосовать: не нравится

»
7 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Probably sir MikeMirzayanov has an answer. :)

»
7 лет назад, # |
  Проголосовать: нравится +2 Проголосовать: не нравится

I have a nodejs script to crawl sample test cases from command-line.

https://github.com/georeth/OJLIBS/blob/master/tools/cf_test_crawler/index.js

It use cheerio to parse the DOM tree(just like jQuery).

I think it is helper to you,

»
7 лет назад, # |
Rev. 3   Проголосовать: нравится +1 Проголосовать: не нравится

Codeforces apparently streams every single update to every single judge job to you in many of the pages in the site even though it's usually not necessary, including those for submissions that aren't on the page, probably because its convenient (aka they're lazy).

If you kill the websocket it'll disable all the junk logs. You can probably just block the host pubsub2.codeforces.com and it'll work.

Codeforces seems to have some sort of channels implemented in their pubsub server like: ws://pubsub2.codeforces.com/ws/bb11..., but I've only seen a 3be6 and bb11 channel, which both look like they stream the same information, so they're probably just different servers. A rooms implementation would be nice; one could easily make one with some kind of message queue and a hook on every api endpoint that modifies the submissions/jobs tables to add messages to the MQ tagged with the desired users for it to send to. Slave servers would read this queue and dispatch messages to the subbers each one is responsible for. This would save users a lot of bandwidth too.

Side note: I think the Codeforces architecture does something like sending all db updates to the submissions/jobs table to a separate pubsub queue for some slave servers to send to users. This scheme shouldn't affect performance much but idk

  • »
    »
    7 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Maybe they did it for some real time update. It works. Now, if it doesn't harm, it is not going to be changed for long time I think. :(

    • »
      »
      »
      7 лет назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      It's for the "status" page. Just block the host temporarily and the logging will stop.