When to use manual sync
Use manual sync when you:- Want to immediately push recent changes to Digible
- Need to verify that changes are syncing correctly
- Have just made important updates that can’t wait for the 2-minute automatic sync cycle
- Want to perform a one-time sync without starting the automatic scheduler
How it works
The manual sync process follows these steps:Click Sync now
The Sync now button (main.py:105-110) triggers the
manual_sync() function immediately.Create connection
shopMaster creates a database connection string using your configured SQL Server credentials (main.py:45).
Execute sync
The
sync_data() function (helper.py:291) is called to process all pending changes from the ChangeLog table.Manual sync uses the same
sync_data() function as automatic sync, ensuring consistent behavior between manual and scheduled operations.Performing a manual sync
To execute a manual sync:- Open shopMaster and navigate to the Home page
- Click the Sync now button
- Wait for the status message to confirm completion
- Check the “Last Sync” timestamp to verify execution
What happens during sync
When you trigger a manual sync, shopMaster:- Checks authentication: Verifies your access token hasn’t expired (helper.py:292)
- Verifies connectivity: Confirms internet connection before attempting sync (helper.py:295)
- Fetches changes: Queries the ChangeLog table for INSERT and UPDATE operations (helper.py:308-311)
- Processes each change:
- INSERT operations call
uploadInsertedContent()(helper.py:318-322) - UPDATE operations call
updateProduct()(helper.py:325-327)
- INSERT operations call
- Clears the log: Removes processed changes from ChangeLog (helper.py:334)
Manual sync only processes INSERT and UPDATE changes. DELETE operations in the ChangeLog table are not synced.
Error handling
The manual sync function handles several error conditions:Expired session
If your Digible access token has expired:Connection issues
If there’s no internet connection, the sync returnsFalse early (helper.py:296-297) without attempting to contact Digible’s API.
API errors
Exceptions during the sync process are caught and logged (helper.py:339-341), and the function returnsFalse to indicate failure.
Integration with automatic sync
You can use manual sync independently or alongside automatic sync:- Manual sync doesn’t start or stop the automatic scheduler
- Both use the same ChangeLog table, so they won’t duplicate work
- Manual sync provides immediate feedback, while automatic sync runs silently in the background
manual_sync() implementation.