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

Getting MaxRetryExceededError when using $expires #946

Open
asyncanup opened this issue Sep 26, 2018 · 1 comment
Open

Getting MaxRetryExceededError when using $expires #946

asyncanup opened this issue Sep 26, 2018 · 1 comment
Assignees

Comments

@asyncanup
Copy link
Contributor

asyncanup commented Sep 26, 2018

snippet to reproduce behavior

var falcor = require('..');
var datasource = falcor({
    cache: {
        todos: [
            {
                name: { $type: 'atom', value: 'name value', $expires: -3 },
                done: false
            },
            {
                name: 'withdraw money from ATM',
                done: true
            }
        ]
    }}).asDataSource();
var model = falcor({ source: datasource });

// const chooseKeys = (k, v) => k.startsWith('$') ? undefined : v;
const logCache = () => {
  console.log(model._root.cache.todos[0].name);
};

model.get('todos[0].name').then(result => {
  console.log('result');
  console.log(result);
  
  logCache();
  setTimeout(() => {
    model.withoutDataSource().get('todos[0].name').subscribe(console.log);
  }, 100);
}, console.error);

output:

{ MaxRetryExceededError: The allowed number of retries have been exceeded.
    at getRequestCycle (/Users/abishnoi/code/falcor/lib/response/get/getRequestCycle.js:26:26)
    at /Users/abishnoi/code/falcor/lib/response/get/getRequestCycle.js:93:21
    at refCountCallback (/Users/abishnoi/code/falcor/lib/request/RequestQueueV2.js:117:17)
    at /Users/abishnoi/code/falcor/lib/request/GetRequestV2.js:120:33
    at Object.onCompleted (/Users/abishnoi/code/falcor/lib/request/flushGetRequest.js:86:13)
    at ModelResponseObserver.onCompleted (/Users/abishnoi/code/falcor/lib/response/ModelResponseObserver.js:64:28)
    at checkCacheAndReport (/Users/abishnoi/code/falcor/lib/response/get/checkCacheAndReport.js:94:22)
    at GetResponse._subscribe (/Users/abishnoi/code/falcor/lib/response/get/GetResponse.js:61:19)
    at GetResponse.subscribe (/Users/abishnoi/code/falcor/lib/response/ModelResponse.js:86:29)
    at flushGetRequest (/Users/abishnoi/code/falcor/lib/request/flushGetRequest.js:81:9)
  name: 'MaxRetryExceededError',
  missingOptimizedPaths: [ [ 'todos', 0, 'name' ] ] }

Same issue when using $expires: 0, other small negative numbers (> -10), or positive numbers smaller than Date.now() + 10

@sdesai
Copy link
Contributor

sdesai commented Sep 27, 2018

I thought we had fixed expires:0 behavior with #905 so would be worth getting our heads around how the above test case differs from the tests added for the above pull request (does this impact the 80% path or not), and would also be useful to determine whether or not the small value (negative or positive) behavior is a regression, or has existed since before the above pull request was merged.

@jcranendonk jcranendonk self-assigned this Sep 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants