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

Fixing GRCPRICE and GRCPRICELASTCHECKED logic #55

Merged
merged 1 commit into from
Jul 12, 2024

Conversation

Jericon
Copy link

@Jericon Jericon commented Jul 11, 2024

This change moves the update to the GRCPRICELASTCHECKED into the block that will only run if a new price has been pulled. It also will attempt to pull a new price even if the update period has not been long enough, but no value is present in the DB.

@makeasnek
Copy link
Owner

Thank you for your bug report and working on this! I would like to ensure that, even in the event of a script malfunction, the script does not repeatedly query the price, so as to keep load on the query URLs low.

I think the issue you encountered with GRCPRICE key missing from the DB can be solved by changing line 4017 to: grc_price = DATABASE.get("GRCPRICE",0). This way, if we haven't been able to get a price, we assume a price of "zero" and those who have configured FTM to only run BOINC "while profitable" won't have BOINC running. And it will always fallback to the last known price, occasionally checking for a new one.

Unless I am missing something here. I am open to additional discussion on this. But if you make the change above (and undo your previous changes to continue re-checking even if GRCPRICELASTCHECKED < max(PRICE_CHECK_INTERVAL, 60) I will gladly merge the PR.

The whole price check mechanism is a little broken now thanks to GRC being delisted from several price-tracking sites.

@Jericon
Copy link
Author

Jericon commented Jul 11, 2024

That makes sense. I can go ahead and change that stuff around.

I do still like the idea of keeping the update to the LASTUPDATED value within the block that indicates that a new value was attained.

What do you think of that? Or should I revert that bit as well?

@Jericon
Copy link
Author

Jericon commented Jul 11, 2024

I've verified on my local instance that the change that is now showing up in this PR is functional.

Prior to the change, I also found that after about 30 minutes of run time, the program crashed with the same error as listed in the #54 .

@makeasnek
Copy link
Owner

This is better, but I think still keep DATABASE["GRCPRICELASTCHECKED"] = datetime.datetime.now() in the original spot before the if statement. This way, if the price check fails, it won't try again for x amount of time. If it's inside the if statement, it will retry frequently.

If there was some logic in there where we differentiated between different types of failure, I'd be ok with continuing to check frequently for example if the site was just offline. But since failure can have many sources (site offline, error grepping html, site blocking you because it thinks you're a bot) etc, I think we need to interpret all forms of failure as a sign to back off and not retry until the next retry interval.

Make that change and I'll merge :).

@Jericon
Copy link
Author

Jericon commented Jul 12, 2024

Done. Squashed all commits into a single one for ease.

@makeasnek
Copy link
Owner

Awesome thanks! Merging!

@makeasnek makeasnek merged commit 279c4bb into makeasnek:main Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants