Flushing async requests on development server for unit testing

31 views
Skip to first unread message

Lenny Rachitsky

unread,
Nov 8, 2011, 3:49:57 PM11/8/11
to Google App Engine
I'm finding that unit testing async based requests is rather tricky,
as the put() often doesn't finish by the time the unit test is run. Is
there any way to do a system-wide flush of all async requests on the
development server? The only other solution I have is to add if branch
that waits for the results to finish if it's on the dev server.

Any advice would be much appreciated.

Nick Johnson

unread,
Nov 9, 2011, 12:21:30 AM11/9/11
to google-a...@googlegroups.com
Hi Lenny,

You should always wait for async requests to finish, including in production. If you don't explicitly wait yourself, the appserver will wait for them to complete before returning the response to the user anyway.

-Nick Johnson


--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.




--
Nick Johnson, Developer Programs Engineer, App Engine


Lenny Rachitsky

unread,
Nov 9, 2011, 2:15:45 PM11/9/11
to Google App Engine
I recently realized that actually, that production waits for them to
complete. Is there any way to reproduce that behavior on the dev
server?

vlad

unread,
May 5, 2012, 2:24:21 PM5/5/12
to google-a...@googlegroups.com
Does Nick's comment mean that devserver discards async puts if code does not wait for result? This is what I am observing. If so I question usefulness of async altogether. If frontend instance needs to wait for completion anyways then what is all the fuss about? - A few odd cases where you may run a couple of DS ops in parallel.



On Wednesday, November 9, 2011 11:15:45 AM UTC-8, Lenny Rachitsky wrote:
I recently realized that actually, that production waits for them to
complete. Is there any way to reproduce that behavior on the dev
server?

On Nov 8, 9:21 pm, Nick Johnson <nickjohn...@google.com> wrote:
> Hi Lenny,
>
> You should always wait for async requests to finish, including in
> production. If you don't explicitly wait yourself, the appserver will wait
> for them to complete before returning the response to the user anyway.
>
> -Nick Johnson
>
>
>
>
>
>
>
>
>
> On Wed, Nov 9, 2011 at 7:49 AM, Lenny Rachitsky <lenny...@gmail.com> wrote:
> > I'm finding that unit testing async based requests is rather tricky,
> > as the put() often doesn't finish by the time the unit test is run. Is
> > there any way to do a system-wide flush of all async requests on the
> > development server? The only other solution I have is to add if branch
> > that waits for the results to finish if it's on the dev server.
>
> > Any advice would be much appreciated.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine" group.
> > To post to this group, send email to google-appengine@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-appengine+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages