-
Notifications
You must be signed in to change notification settings - Fork 121
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
Have a question about on_start stage #66
Comments
This is probably is going to use the first one and ignore the last. However, I'm not completely sure. I'll get back to you soon. Btw - sorry for the delay to answer you. I have numerous github repos and it's hard to follow all the notifications. |
I am new to cramp.When I try to modify your first example, I got stucked. What I want to do is hook another two methods on the on_start stage. These two methods are simply reply some message just like the start method, but unfortunately, none of them are working correctly. Maybe you could give me a suggestion why is that. on_start :start1 def star1 def start2 def start
end |
This is a bit after the fact, but Cramp will render as many times as you like. After the action starts, you can render multiple times to, for example, stream data to a client as you parse it. The only thing you have to be careful of is calling render after finish has been called. I don't know for certain if that will cause any problems, but it can't hurt to be safe. There's also no order guarantee. There's nothing to say that your on_start callbacks will be gotten to before the start method has finished. |
As mentioned, on_start callbacks provide multiple entry points into the Started Request state. In the example, there are two entries:
on_start :setup_redis_callbacks
on_start :fetch_twitter
I want to know is if both callbacks provides render, what will happen? Will it mess up the output for a client?
The text was updated successfully, but these errors were encountered: