kaazing / http2-cache.js

2 stars 11 forks source link

stale-while-revalidate implementation update #66

Closed hthetiot closed 6 years ago

hthetiot commented 6 years ago

For Reviewer

dpwspoon commented 6 years ago

I would expect a call to cache.revalidate(requestInfo); on https://github.com/kaazing/http2-cache.js/pull/66/files#diff-76c4bbb65fb81fc4fc6a813da39add7bR122, And a call to validated https://github.com/kaazing/http2-cache.js/pull/66/files#diff-76c4bbb65fb81fc4fc6a813da39add7bR136.

I also think you want to remove the entry in is Validating on in case of errors. I.E. https://github.com/kaazing/http2-cache.js/pull/66/files#diff-76c4bbb65fb81fc4fc6a813da39add7bR144 and maybe here: https://github.com/kaazing/http2-cache.js/pull/66/files#diff-3891df25a9a726b84ac6e031b78b8ef9R309

The expected test case for this would be: User initiated request to http://example.com, push promise request with cache-control:no-cache to http://example.com, response with stale-while-revalidating=large. Then another user-initiated request to http://example.com that is served by cache because stale-while-revalidating and it is validating (because push promise is in flight). Then response to push promise completes.