Offline Mode
Working without internet in the z8 Timer desktop app
The z8 Timer works even when you're offline. Clock in, clock out, and take breaks - everything syncs when you're back online.
How Offline Mode Works
┌─────────────────────────────────────────────────────────────┐
│ Online │
│ │
│ Clock In ──────► API ──────► Server ──────► Database │
│ │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ Offline │
│ │
│ Clock In ──────► Queue ──────► SQLite (local) │
│ │ │
│ │ (30s retry loop) │
│ ▼ │
│ Online? ──────► API ──────► Server │
│ │
└─────────────────────────────────────────────────────────────┘- Action attempted - Clock in/out/break
- Network check - If API is unreachable
- Queue locally - Store in SQLite database
- Optimistic update - UI reflects the action immediately
- Background sync - Retry every 30 seconds
- Success - Remove from queue when synced
Offline Indicator
When offline, you'll see a visual indicator:
┌─────────────────────────────────────┐
│ ⚙️ 📶✕ Offline z8 Timer │
│ │
│ ... │
└─────────────────────────────────────┘| Indicator | Meaning |
|---|---|
| WiFi icon with slash | No internet connection |
| "Offline" text | Currently in offline mode |
| Yellow status dot | Actions queued for sync |
Actions That Work Offline
| Action | Offline Support |
|---|---|
| Clock in | Queued |
| Clock out | Queued |
| Clock out with break | Queued |
| View status | Uses cached state |
| Settings changes | Saved locally |
The Offline Queue
Actions are stored in a local SQLite database:
Queue Entry Structure
┌────────────────────────────────────────────────┐
│ ID: 1 │
│ Action: clock_in │
│ Timestamp: 2024-01-15T09:00:00Z │
│ Retry Count: 0 │
│ Created: 2024-01-15T09:00:05Z │
└────────────────────────────────────────────────┘Queue Processing
Action queued
When offline, action saved to SQLite with timestamp
Background processor
Runs every 30 seconds
Retry attempt
Tries to sync queued actions
Success or retry
If successful, removed from queue. If failed, retry count incremented.
Retry Limits
| Retry Count | Status |
|---|---|
| 0-4 | Will retry |
| 5+ | Skipped (logged as warning) |
Max Retries
After 5 failed retries, an action is skipped. This prevents infinite loops from permanent errors. Check your connection and try again manually if needed.
Viewing Queue Status
To see pending offline actions:
- Open the app
- Look for the offline indicator
- Pending count shown if > 0
Or check programmatically via the tray menu status.
Syncing Process
When connection is restored:
Offline Queue: 3 items
├── 09:00 - Clock In → Syncing... ✓ Done
├── 12:00 - Clock Out → Syncing... ✓ Done
└── 12:30 - Clock In → Syncing... ✓ Done
Queue cleared!- Connection detected - API becomes reachable
- Process queue - Oldest first (FIFO)
- Sync each action - With original timestamp
- Update UI - Reflect synced state
- Clear queue - Remove successful items
Conflict Handling
What happens if there's a conflict:
| Scenario | Handling |
|---|---|
| Clock in while already in | Server rejects, entry removed from queue |
| Clock out while already out | Server rejects, entry removed from queue |
| Timestamp in future | Server adjusts to server time |
| Very old timestamp | Action processed with original time |
The server is the source of truth. Local queue only stores intent.
Data Storage Location
The offline queue is stored in:
| Platform | Location |
|---|---|
| Windows | %APPDATA%\com.z8.timer\offline_queue.db |
| macOS | ~/Library/Application Support/com.z8.timer/offline_queue.db |
| Linux | ~/.config/com.z8.timer/offline_queue.db |
This is a SQLite database that persists across app restarts.
Signing Out While Offline
Warning
Signing out while offline will clear the offline queue. Pending time entries will be lost.
If you must sign out while offline:
- Note your pending actions
- Sign out (queue is cleared)
- When online, manually enter the time entries in the web app
Best Practices
- Check for pending entries before signing out
- Let the app run - Background sync handles everything
- Don't force quit when offline - Let it sync first
- Trust the timestamps - Entries use the original time, not sync time
- Verify important entries in the web app after sync
Troubleshooting
Queue not syncing
- Check internet connection
- Verify server URL in settings
- Check if signed in - Session may have expired
- Restart the app - Reinitializes sync processor
Entries missing after sync
- Check web app - Entries should appear there
- Check for conflicts - Duplicate clock in/out
- Check queue - May still be pending
Database corruption
If offline queue is corrupted:
- Close the app
- Delete
offline_queue.db - Restart the app (creates fresh database)
Deleting the database loses all pending entries. Only do this as a last resort.