Windows200000 / TwitchDropsMiner-updated

An app that allows you to AFK mine timed Twitch drops, with automatic drop claiming and channel switching.
MIT License
353 stars 21 forks source link

Getting an exception and progress stops #185

Open tsbreuer opened 2 weeks ago

tsbreuer commented 2 weeks ago

Description

It throws and error and stops all progress randomly

To Reproduce

I only noticed it with this week's of rust twitch drops.

Expected behavior

Should just keep progressing

Observed behavior

No further progress is done until app is restarted

Screenshots

No response

Logs

21:22:41: !!!required_minutes for "Kai Rust Hoodie" is 0 This could be due to a subscription requirement, tracked in Issue #101!!! 21:22:51: Watching: xQc 21:23:03: Progress: 54/60 - Rust, TrainwrecksTV AR 21:23:35: ERROR: Exception in task 21:23:35: Traceback (most recent call last): 21:23:35: File "channel.py", line 385, in send_watch 21:23:35: File "twitch.py", line 1575, in gql_request 21:23:35: exceptions.MinerException: GQL error: [{'message': 'PersistedQueryNotFound'}] 21:23:35: 21:23:35: The above exception was the direct cause of the following exception: 21:23:35: 21:23:35: Traceback (most recent call last): 21:23:35: File "utils.py", line 139, in wrapper 21:23:35: File "twitch.py", line 1049, in _watch_loop 21:23:35: File "channel.py", line 389, in send_watch 21:23:35: exceptions.MinerException: Channel: xqc

OS

Windows 11

Build

.exe

Version/Commit

v16.dev.05fd654

Additional context

No response

motxh commented 2 weeks ago

Good morning, I have the same error. The program is on a remote PC, and not to go to it every time and not to restart, I made a small bat script that would conditionally start all the programs at once, and they would work for 1200 seconds, then closed, and after 5 seconds would start again and go into the tray

`@echo off

:start start "Название программы 1" "C:\f\1\1.exe" start "Название программы 2" "C:\f\2\2.exe" start "Название программы 3" "C:\f\3\3.exe" start "Название программы 4" "C:\f\4\4.exe" start "Название программы 5" "C:\f\5\5.exe" start "Название программы 6" "C:\f\6\6.exe" start "Название программы 7" "C:\f\7\7.exe" start "Название программы 8" "C:\f\8\8.exe" start "Название программы 9" "C:\f\9\9.exe" start "Название программы 10" "C:\f\10\10.exe" start "Название программы 11" "C:\f\11\11.exe"

timeout /t 900 /nobreak >nul

taskkill /im "1.exe" /f taskkill /im "2.exe" /f taskkill /im "3.exe" /f taskkill /im "4.exe" /f taskkill /im "5.exe" /f taskkill /im "6.exe" /f taskkill /im "7.exe" /f taskkill /im "8.exe" /f taskkill /im "9.exe" /f taskkill /im "10.exe" /f taskkill /im "11.exe" /f

timeout /t 5 >nul

goto start`

Maybe such a temporary solution will help you too, use it to your heart's content. You can add many more folders to this code. It is very convenient in my opinion, than to go every time to a folder and click to launch the program

stanorama commented 2 weeks ago

This fixed it for me. Just adding the error 'PersistedQueryNotFound' to the list of errors that force a retry is sufficient.

           for response_json in response_list:
                if "errors" in response_json:
                    for error_dict in response_json["errors"]:
                        if "message" in error_dict and error_dict["message"] in (
                            # "service error",
                            "service unavailable",
                            "service timeout",
                            "context deadline exceeded",
                            "PersistedQueryNotFound",
                        ):
                            force_retry = True
                            break
                    else:
                        logger.error(f"GQL error: {response_json['errors']}")
                        # raise MinerException(f"GQL error: {response_json['errors']}")
                        force_retry = True
                if force_retry:
                    break
spix18 commented 1 week ago

14:47:20: Progress: 180/180 - Albion Online, Horizons Week 3 - #4/7 14:47:38: Fatal error encountered: 14:47:38: 14:47:38: Traceback (most recent call last): 14:47:38: File "main.py", line 160, in main 14:47:38: File "twitch.py", line 772, in run 14:47:38: File "twitch.py", line 828, in _run 14:47:38: File "inventory.py", line 238, in claim 14:47:38: File "inventory.py", line 139, in claim 14:47:38: File "inventory.py", line 155, in _claim 14:47:38: File "twitch.py", line 1579, in gql_request 14:47:38: exceptions.MinerException: GQL error: [{'message': 'service error', 'path': ['claimDropRewards']}] 14:47:38: 14:47:38: Exiting... 14:47:39: 14:47:39: Application Terminated. 14:47:39: Close the window to exit the application.

spix18 commented 1 week ago

16:49:17: ERROR: Exception in task 16:49:17: Traceback (most recent call last): 16:49:17: File "channel.py", line 385, in send_watch 16:49:17: File "twitch.py", line 1546, in gql_request 16:49:17: File "contextlib.py", line 210, in aenter 16:49:17: File "twitch.py", line 1497, in request 16:49:17: exceptions.ExitRequest: Application was requested to exit 16:49:17: 16:49:17: The above exception was the direct cause of the following exception: 16:49:17: 16:49:17: Traceback (most recent call last): 16:49:17: File "utils.py", line 139, in wrapper 16:49:17: File "twitch.py", line 1049, in _watch_loop 16:49:17: File "channel.py", line 389, in send_watch 16:49:17: exceptions.MinerException: Channel: thewhelps

FomaDima commented 1 week ago

Today there are literally only such mistakes. Although just a day ago everything was fine.

add It's strange, but after a couple of hours everything became fine

Windows200000 commented 5 days ago

This fixed it for me. Just adding the error 'PersistedQueryNotFound' to the list of errors that force a retry is sufficient.

           for response_json in response_list:
                if "errors" in response_json:
                    for error_dict in response_json["errors"]:
                        if "message" in error_dict and error_dict["message"] in (
                            # "service error",
                            "service unavailable",
                            "service timeout",
                            "context deadline exceeded",
                            "PersistedQueryNotFound",
                        ):
                            force_retry = True
                            break
                    else:
                        logger.error(f"GQL error: {response_json['errors']}")
                        # raise MinerException(f"GQL error: {response_json['errors']}")
                        force_retry = True
                if force_retry:
                    break

That's a bad idea. The error means that the PersistedQuery is invalid, a thing that is generally constant and the program treats it as such. Doing this will at best just hide the problem, at worst alert twitch that this is a bot and prevent TDM from working all together/ban your account, because no user refreshes so many times a second.

You can search for this in this or DevilXD's repo for further detail.

I'm sorry I still don't have time to attend to this, there is still a lot of work with moving and starting uni next year.