Files
Microsoft-Rewards-Bot/docs/jobstate.md
LightZirconite 43ed6cd7f8 refactor: remove legacy scheduling and analytics code
- Deleted the scheduler module and its associated functions, transitioning to OS-level scheduling.
- Removed the Analytics module and its related interfaces, retaining only a placeholder for backward compatibility.
- Updated ConfigValidator to warn about legacy schedule and analytics configurations.
- Cleaned up StartupValidator to remove diagnostics and schedule validation logic.
- Adjusted Load.ts to handle legacy flags for diagnostics and analytics.
- Removed unused diagnostics capturing functionality.
2025-11-03 19:18:09 +01:00

2.7 KiB
Raw Blame History

💾 Job State

Resume interrupted tasks automatically


💡 What Is It?

Saves progress after each completed task. If script crashes or stops, it resumes exactly where it left off.

🔁 New: Completed accounts are tracked per day. When you restart the bot after a failure, it skips accounts already finished and jumps directly to the remaining ones.

Already enabled by default!


How It Works

Progress Tracking

sessions/job-state/
├── account1@email.com/
│   ├── daily-set-2025-10-16.json
│   ├── desktop-search-2025-10-16.json
│   └── mobile-search-2025-10-16.json
└── account2@email.com/
    └── ...
  • Per-account — Independent progress
  • Date-specific — Fresh start each day
  • Auto-cleanup — Old files remain for history

🎯 Benefits

Interrupted Runs

Scenario Without Job State With Job State
Power outage Start from beginning Resume from last task
Manual stop Lose all progress Pick up where left off
Network failure Redo everything Continue remaining tasks

⚙️ Configuration

Already enabled:

{
  "jobState": {
    "enabled": true,
    "skipCompletedAccounts": true, // Skip accounts already finished today
    "dir": ""  // Empty = use default location
  }
}

Custom location:

{
  "jobState": {
    "enabled": true,
    "skipCompletedAccounts": true,
    "dir": "/custom/path/job-state"
  }
}

Set skipCompletedAccounts to false (or export REWARDS_DISABLE_ACCOUNT_SKIP=1/true) if you need to force every pass to run all accounts—for example when using passesPerRun > 1 or when intentionally repeating the whole rotation in the same day.


🧹 Maintenance

Reset Progress (Fresh Start)

# Reset all accounts
Remove-Item -Recurse -Force sessions/job-state/

# Reset one account
Remove-Item -Recurse -Force sessions/job-state/user@email.com/

Cleanup Old Files

# Keep last 7 days only
Get-ChildItem sessions/job-state -Recurse -Filter "*.json" | Where-Object {$_.LastWriteTime -lt (Get-Date).AddDays(-7)} | Remove-Item

🛠️ Troubleshooting

Problem Solution
Tasks not resuming Check file permissions
Duplicate execution Ensure system time is accurate
Excessive files Implement cleanup schedule

📚 Next Steps

Need automation?
External Scheduling

Need troubleshooting tips?
Troubleshooting Guide


← Back to Hub | Config Guide