Billyzou0741326 / bilibili-live-monitor-ts

bilibili - b站直播监控
https://billyzou0741326.github.io/bilibili-live-monitor-ts/
MIT License
28 stars 4 forks source link

Crawler is blocking all other HTTP requests while it's running #52

Closed blu3mania closed 4 years ago

blu3mania commented 4 years ago

Since all those requests from roomid-handler are filling the queue in Xhr's RateLimiter so other requests have to wait in the queue for a long time. I added a RateLimiter on roomid-handler to give other clients a chance to sneak in their requests.

Also, in some scenarios rooms with activities are not added to db, so simplified add_to_db handling to purely rely on raffle.

As a side note, I notice that you are using node.js 11+ features, like optional offset in Buffer.writeUInt32BE(), and since @type.node is asking for a version 13.x, maybe you want to update node.js badge to increase the required version?

Billyzou0741326 commented 4 years ago

I'm good with the use of RateLimiter. As for the add_to_db part, I'd like to keep the original implementation. I believe there should be a higher limit (at least two gifts from the same room) to be considered eligible for adding to the db. The add_to_db event is such a filtering mechanism. At that, I want to keep the original implementation of FixedGuardMonitor too. Its add_to_db simply serves to update the timestamp of a room.

Billyzou0741326 commented 4 years ago

https://github.com/Billyzou0741326/bilibili-live-monitor-ts/blob/5258cac652286d98537404aa29fb79255f7565b2/src/client/tcp-client.ts#L101

Indeed I forgot to specify the offset, I meant to use the one compatible for 10.x.x

blu3mania commented 4 years ago

k, updated

Billyzou0741326 commented 4 years ago

Great, thank you