Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure outbox messages are sent in the correct order #3272

Merged
merged 4 commits into from
Jan 14, 2019

Commits on Jan 14, 2019

  1. outbox: Ensure messages are sent in the correct order.

    Fixes zulip#3259.
    
    When sending more than one message with poor connectivity there is a
    likely and unwanted scenario that can happen: mesages sent early might
    fail to reach the server but later ones might succeed thus resulting
    in the incorrect order.
    
    Extracting the try-catch block outside the 'forEach' loop ensures that
    a single failed message will also fail the sending of later messages.
    
    Better retry strategy is coming in a separate commit soon.
    borisyankov authored and gnprice committed Jan 14, 2019
    Configuration menu
    Copy the full SHA
    071feea View commit details
    Browse the repository at this point in the history
  2. outbox: Split 'trySendMessages' action into two functions.

    Extract the message sending code out of `trySendMessages` as a
    separate function.  Rename the action to `sendOutbox`.
    
    This is to facilitate retrying on failed send without reissuing
    the `toggleOutboxSending` actions.
    
    This also follows a well established convention for `try*` functions:
     * they handle an exception and do not throw
     * they return true/false depending on success/exception
    borisyankov authored and gnprice committed Jan 14, 2019
    Configuration menu
    Copy the full SHA
    d306199 View commit details
    Browse the repository at this point in the history
  3. outbox: Retry if message sending fails.

    Fixes zulip#3120.
    
    Try sending messages and keep retrying if sending fails.
    Using `progressiveTimeout` we make sure we are not trying too often.
    
    Thanks to `state.session.outboxSending` we are sure there will be
    no two loops at the same time.
    borisyankov authored and gnprice committed Jan 14, 2019
    Configuration menu
    Copy the full SHA
    f00dce5 View commit details
    Browse the repository at this point in the history
  4. outbox: Remove not needed sendOutbox on connectivity change.

    Now that we are retrying on failed message send we are handling
    all possible cases where we might end up with unsent messages:
    * if message send fails immediately (we keep retrying)
    * if the app was closed with unsent messages (we try again on
      next launch, inside `doInitialFetch` -- and keep retrying)
    
    The connectivity change was a good heuristic with the imperfect
    retry strategy but is not needed any more.
    borisyankov authored and gnprice committed Jan 14, 2019
    Configuration menu
    Copy the full SHA
    400f4ac View commit details
    Browse the repository at this point in the history