Skip to content

Attachment upload requests are only persisted while offline #7935

Description

@thienlnam

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Creating separate ticket for #3867 (comment)

NetworkRequestQueue.saveRetryableRequests is only called in the if(isOffline) block

App/src/libs/Network.js

Lines 185 to 206 in 425e718

if (isOffline) {
if (!networkRequestQueue.length) {
return;
}
const retryableRequests = [];
// If we have a request then we need to check if it can be persisted in case we close the tab while offline.
// We filter persisted requests from the normal Queue to remove duplicates
networkRequestQueue = _.reject(networkRequestQueue, (request) => {
const shouldRetry = lodashGet(request, 'data.shouldRetry');
if (shouldRetry && request.data.persist) {
// exclude functions as they cannot be persisted
const requestToPersist = _.omit(request, val => _.isFunction(val));
retryableRequests.push(requestToPersist);
return true;
}
});
if (retryableRequests.length) {
NetworkRequestQueue.saveRetryableRequests(retryableRequests);
}
return;
}

Recent changes alleviate this to some extent - when a request is persisted to storage it will only be removed after it's successfully performed - it'll be retried until eventually succeeding
But it would only get to be persisted if you were offline to begin with

Action Performed:

  1. Try to send a large PDF file (Makes it easier to test)
  2. After sending, close the app
  3. Re-open the app and see that it was not uploaded

Expected Result:

Attachment would try to re-upload after the app was reopened

Actual Result:

Attachment stopped sending

Workaround:

Stay online while uploading, or start offline for the request to be persisted

Platform:

Where is this issue occurring?

  • Web
  • iOS
  • Android
  • Desktop App
  • Mobile Web

Version Number:
Reproducible in staging?: Yes
Reproducible in production?: Yes
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Expensify/Expensify Issue URL:
Issue reported by: @kidroca
Slack conversation:

View all open jobs on GitHub

Metadata

Metadata

Labels

EngineeringExternalAdded to denote the issue can be worked on by a contributorWeeklyKSv2

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions