-
-
Notifications
You must be signed in to change notification settings - Fork 584
optimize CrontabWatcher #1221
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
optimize CrontabWatcher #1221
Conversation
PR Compliance Guide 🔍(Compliance updated until commit c6b476c)Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label Previous compliance checksCompliance check up to commit c6b476c
|
||||||||||||||||||||||||||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||
|
Reviewed |
PR Type
Enhancement, Bug fix
The problem of Redis timeout causing job crashes
Description
Add exception handling to prevent service crashes
Implement try-catch block with logging and recovery
Increase delay to 3 seconds on error for resilience
Improve code structure with better error management
Diagram Walkthrough
flowchart LR A["CrontabWatcher Loop"] --> B["Try Block"] B --> C["Lock & Run Checker"] C --> D{Lock Acquired?} D -->|Yes| E["Execute Task"] D -->|No| F["Delay 1s"] E --> G["Delay 1s"] C --> H["Catch Exception"] H --> I["Log Warning"] I --> J["Delay 3s"] F --> A G --> A J --> AFile Walkthrough
CrontabWatcher.cs
Add exception handling and error recoverysrc/Infrastructure/BotSharp.Core.Crontab/Services/CrontabWatcher.cs