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

Explicit request start #104

Merged
merged 3 commits into from Aug 28, 2016
Merged

Explicit request start #104

merged 3 commits into from Aug 28, 2016

Conversation

pcantrell
Copy link
Member

@pcantrell pcantrell commented Aug 27, 2016

#98 tried to avoid making apps ever have to explicitly start requests by using a too-clever hack involving isUniquelyReferenced. This was a bad idea: it was confusing, and precluded several kinds of request decoration one might want to do.

This PR adds a start() method to the Request protocol. Under most circumstances, apps will not have to call it. Siesta will still automatically start requests in two situations:

  • Resource.request(…) (and thus load() and loadIfNeeded() as well) will start whatever request comes out of the configured decorators.
  • RequestChainAction.PassTo starts the returned request.

Manual start is useful in two cases:

  • A request decorator may replace original request A with replacement request B, but still hold on to A. In this case, B is automatically started, but A is not. This allows you to delay the first attempt of a request.
  • Request.repeated() no longer returns an already-started request. This allows for delayed retries.

@pcantrell pcantrell merged commit bee589f into master Aug 28, 2016
@pcantrell pcantrell deleted the explicit-request-start branch August 28, 2016 03:29
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

Successfully merging this pull request may close these issues.

None yet

1 participant