TwitchDropGrabber icon indicating copy to clipboard operation
TwitchDropGrabber copied to clipboard

After a timeout occurs, the process neither exits nor continues to run

Open fzhyzamt opened this issue 4 years ago • 3 comments

Hi! I'm trying to run this on the server, but I find that I occasionally run into timeouts. output:

[VERBOSE] [Wed, 17 Nov 2021 09:39:42 GMT] Trying warframe
[VERBOSE] [Wed, 17 Nov 2021 09:40:04 GMT] Current url: https://www.twitch.tv/warframe
[VERBOSE] [Wed, 17 Nov 2021 09:40:04 GMT] Channel status: offline
[VERBOSE] [Wed, 17 Nov 2021 09:40:04 GMT] Video duration: 2162.582302
[VERBOSE] [Wed, 17 Nov 2021 09:40:04 GMT] Channel live: false
[VERBOSE] [Wed, 17 Nov 2021 09:40:04 GMT] Channel offline, trying next channel
[Wed, 17 Nov 2021 09:40:04 GMT] No channels online! Trying again after the timeout
[VERBOSE] [Wed, 17 Nov 2021 09:45:04 GMT] Timer function called
[VERBOSE] [Wed, 17 Nov 2021 09:45:19 GMT] 0 claim buttons found.
[VERBOSE] [Wed, 17 Nov 2021 09:45:19 GMT] Current url: https://www.twitch.tv/warframe
[VERBOSE] [Wed, 17 Nov 2021 09:45:19 GMT] Channel status: offline
[VERBOSE] [Wed, 17 Nov 2021 09:45:19 GMT] Video duration: 2477.933973
[Wed, 17 Nov 2021 09:45:19 GMT] Channel offline
[Wed, 17 Nov 2021 09:45:19 GMT] Finding online channel...
[VERBOSE] [Wed, 17 Nov 2021 09:45:19 GMT] Trying warframe
(node:1710) UnhandledPromiseRejectionWarning: TimeoutError: Navigation timeout of 30000 ms exceeded
    at Promise.then (/var/local/TwitchDropGrabber/node_modules/puppeteer/lib/cjs/puppeteer/common/LifecycleWatcher.js:106:111)
(node:1710) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1710) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

https://github.com/AlexSterk/TwitchDropGrabber/blob/0de0345d863cd1f3af7074e52748f9b6d86f7106/src/index.ts#L171-L176 I'm not familiar with nodejs, I guess it's because an exception was thrown here, which caused the next timer to not be set?

fzhyzamt avatar Nov 17 '21 11:11 fzhyzamt

Basically the browser (Chrome) can’t load the Warframe twitch channel page (fast enough). So it’s related to your internet or maybe a proxy or VPN you use?

Right now I don’t have a way to handle that situation. I suppose I can come up with something in the future.

However, something you could try right now, is run the script for say, an hour, kill it (regardless of whether it crashes), and run it again in a loop.

I’ll think about adding in a better way to handle this problem

AlexSterk avatar Nov 17 '21 11:11 AlexSterk

step1: create a screen process and enter the TwitchDropGrabber dir

> screen -S T
> cd TwitchDropGrabber/

step2: create a shell script

> vim twitch.sh
screen -S "T" -X stuff "^C"
screen -S "T" -X stuff "\n"
screen -S "T" -X stuff "sleep 10"
screen -S "T" -X stuff "\n"
screen -S "T" -X stuff "npm start -- -g \"Tom Clancy's Rainbow Six Siege\""
screen -S "T" -X stuff "\n"

step3: edit crontab

> crontab -e
0 * * * * /bin/bash /PATH/TO/twitch.sh

SekiBetu avatar Nov 20 '21 08:11 SekiBetu

How about Windows?

Terli avatar May 08 '22 16:05 Terli