Skip to content

Commit

Permalink
remove settimeout for rof data sync (#1659)
Browse files Browse the repository at this point in the history
* WFNEWS-1631 Await response from storage for offline ROF submission

* Alerts

* Alerts

* Set random interval for offline ROF sync

* More alerts

* Try with just navigator geolocation

* Try with just navigator geolocation

* Alerts, settimeout for data sync

* Alerts, remove settimeout

* More changes

* More changes

* Submit ROF to storage if unsuccesful online submission

* Submit ROF to storage if unsuccesful online submission

* Run background task every 30 seconds

* remove settimeout for rof data sync

* remove settimeout for rof data sync
  • Loading branch information
ssylver93 authored Feb 22, 2024
1 parent 2c7b36b commit a5e67c8
Showing 1 changed file with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,10 @@ valueMatch = trimmedAddress.substring(0, valueLength);
},
);
})

return promise;
}


async checkLocationServiceStatus(): Promise<boolean> {
const timeoutDuration = 5000; // 5 seconds limit

Expand Down Expand Up @@ -236,14 +235,8 @@ valueMatch = trimmedAddress.substring(0, valueLength);
async syncDataWithServer() {
await this.storage.create();
try {
let offlineReport;

// Fetch and submit locally stored data
// Set timeout between 10 and 30 seconds
const random = Math.floor((Math.random()*30000)+10000);
setTimeout(async () => {
offlineReport = await this.storage.get('offlineReportData');
}, random);
const offlineReport = await this.storage.get('offlineReportData');

if (offlineReport) {
// Send the report to the server
Expand Down

0 comments on commit a5e67c8

Please sign in to comment.