-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(workers): enhance error handling and worker selection in Distrib…
…uteWork (#540) * feat(workers): enhance error handling and worker selection in DistributeWork - Collect errors from all failed worker attempts - Continue trying workers after failures until max attempts reached - Include all collected errors in final error message - Improve logging for detailed error information - Maintain existing behavior of returning on first success Ensures all eligible workers are attempted before failing, improving reliability and providing comprehensive error reports for debugging. * feat: add Twitter cookies example template Add twitter_cookies.example.json as a template for storing Twitter authentication cookies. This file provides a structure for users to input their own cookie values securely. * feat(workers): Improve worker selection for Twitter authentication errors - Modify DistributeWork function to continue trying workers on Twitter auth failures - Implement specific error handling for Twitter credential authentication errors - Ensure up to MaxRemoteWorkers (10) attempts before giving up - Enhance logging to provide better visibility into worker selection process This change aims to increase resilience in the face of Twitter API authentication issues by allowing the system to try multiple workers before failing. * Enhance worker selection to try all available remote workers - Modify DistributeWork function in worker_manager.go to attempt all remote workers - Continue worker selection loop on Twitter authentication errors - Only return early on successful worker response - Improve error handling and logging for better debugging - Ensure MaxRemoteWorkers limit is respected This change addresses an issue where the system was prematurely returning after the first worker failure, instead of trying all available workers. Now, it will attempt to use each eligible remote worker before falling back to local execution or reporting a failure, improving the robustness of the worker selection process. * feat(workers): Enhance worker selection to try all available remote workers - Modify GetEligibleWorkers in worker_selection.go to return all eligible workers - Update DistributeWork in worker_manager.go to attempt connection with each worker - Improve error handling and logging for better visibility into worker selection process This change addresses an issue where the system was only attempting to use a single remote worker before falling back to local execution. Now, it will attempt to connect to and use each eligible remote worker before giving up, improving the robustness of the worker selection process and increasing the chances of successful task completion. Part of #XXX (replace with actual ticket number)
- Loading branch information
1 parent
8b505fe
commit 8afdc49
Showing
3 changed files
with
134 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// How to obtain this information from your browser: | ||
// 1. Log in to Twitter in your web browser | ||
// 2. Open the browser's developer tools (usually F12 or right-click > Inspect) | ||
// 3. Go to the "Application" or "Storage" tab | ||
// 4. In the left sidebar, expand "Cookies" and click on "https://twitter.com" | ||
// 5. Look for the cookie names listed above and copy their values | ||
// 6. Replace the "X" placeholders in the "Value" field with the actual values | ||
// 7. Save the file as "twitter_cookies.json" (remove ".example" from the filename) | ||
|
||
// Note: Most browsers only show the Name, Value, Domain, and Path fields in the developer tools. | ||
// The other fields (Expires, MaxAge, Secure, HttpOnly, SameSite) may not be visible or editable. | ||
// You can leave these fields as they are in this template. | ||
|
||
// IMPORTANT: Be extremely cautious with your auth_token and other sensitive cookies. | ||
// Never share them publicly or commit them to version control. | ||
|
||
[ | ||
{ | ||
"Name": "personalization_id", | ||
"Value": "v1_XXXXXXXXXXXXXXXXXXXXXXXX==", | ||
"Path": "", | ||
"Domain": "twitter.com", | ||
"Expires": "0001-01-01T00:00:00Z", | ||
"RawExpires": "", | ||
"MaxAge": 0, | ||
"Secure": false, | ||
"HttpOnly": false, | ||
"SameSite": 0, | ||
"Raw": "", | ||
"Unparsed": null | ||
}, | ||
{ | ||
"Name": "kdt", | ||
"Value": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", | ||
"Path": "", | ||
"Domain": "twitter.com", | ||
"Expires": "0001-01-01T00:00:00Z", | ||
"RawExpires": "", | ||
"MaxAge": 0, | ||
"Secure": false, | ||
"HttpOnly": false, | ||
"SameSite": 0, | ||
"Raw": "", | ||
"Unparsed": null | ||
}, | ||
{ | ||
"Name": "twid", | ||
"Value": "u=XXXXXXXXX", | ||
"Path": "", | ||
"Domain": "twitter.com", | ||
"Expires": "0001-01-01T00:00:00Z", | ||
"RawExpires": "", | ||
"MaxAge": 0, | ||
"Secure": false, | ||
"HttpOnly": false, | ||
"SameSite": 0, | ||
"Raw": "", | ||
"Unparsed": null | ||
}, | ||
{ | ||
"Name": "ct0", | ||
"Value": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", | ||
"Path": "", | ||
"Domain": "twitter.com", | ||
"Expires": "0001-01-01T00:00:00Z", | ||
"RawExpires": "", | ||
"MaxAge": 0, | ||
"Secure": false, | ||
"HttpOnly": false, | ||
"SameSite": 0, | ||
"Raw": "", | ||
"Unparsed": null | ||
}, | ||
{ | ||
"Name": "auth_token", | ||
"Value": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", | ||
"Path": "", | ||
"Domain": "twitter.com", | ||
"Expires": "0001-01-01T00:00:00Z", | ||
"RawExpires": "", | ||
"MaxAge": 0, | ||
"Secure": false, | ||
"HttpOnly": false, | ||
"SameSite": 0, | ||
"Raw": "", | ||
"Unparsed": null | ||
} | ||
] |