Skip to content
This repository has been archived by the owner on Mar 20, 2021. It is now read-only.

Handle fetchQueue error for preempted requests #373

Merged
merged 1 commit into from
Jul 7, 2014

Conversation

kpdecker
Copy link
Contributor

@kpdecker kpdecker commented Jun 5, 2014

When a particular instance preempts a request round trip, the fetch queue can
be left in an indeterminate state that can cause future requests to error out
due to assumptions about the fetch queue’s contents.

This change ensures that the fetchQueue is completely cleaned. Additionally it
protects from NPEs that might occur due to preempted requests in promise
supporting environments.

When a particular instance preempts a request round trip, the fetch queue can be left in an indeterminate state that can cause future requests to error out due to assumptions about the fetch queue’s contents.

This change ensures that the fetchQueue is completely cleaned. Additionally it protects from NPEs that might occur due to preempted requests in promise supporting environments.
@@ -398,6 +399,11 @@ function fetchQueue(options, $super) {
var index = _.indexOf(fetchQueue, this);
if (index >= 0) {
fetchQueue.splice(index, 1);

// If we are the last of the fetchQueue entries, invalidate the queue.
if (!fetchQueue.length && fetchQueue === self.fetchQueue) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When is fetchQueue !== self.fetchQueue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the reset queue option is used then the fetchQueue object will be reset.

On Mon, Jun 9, 2014 at 12:17 PM, Roman Bataev notifications@github.com
wrote:

In src/loading.js:

@@ -398,6 +399,11 @@ function fetchQueue(options, $super) {
var index = _.indexOf(fetchQueue, this);
if (index >= 0) {
fetchQueue.splice(index, 1);
+

  •    // If we are the last of the fetchQueue entries, invalidate the queue.
    
  •    if (!fetchQueue.length && fetchQueue === self.fetchQueue) {
    

When is fetchQueue !== self.fetchQueue?


Reply to this email directly or view it on GitHub
https://github.com/walmartlabs/thorax/pull/373/files#r13552358.

@candid82
Copy link
Contributor

candid82 commented Jul 7, 2014

+1

kpdecker added a commit that referenced this pull request Jul 7, 2014
Handle fetchQueue error for preempted requests
@kpdecker kpdecker merged commit 6f01e07 into master Jul 7, 2014
@kpdecker kpdecker deleted the preempt-fetch-queue branch July 7, 2014 20:41
@kpdecker
Copy link
Contributor Author

kpdecker commented Jul 7, 2014

Released in 3.0.0-alpha.10

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants