Example #1
0
func startPoller(w http.ResponseWriter, r *http.Request) {
	ctx := appengine.NewContext(r)
	err := runtime.RunInBackground(ctx, poller)
	if err != nil {
		http.Error(w, err.Error(), 500)
	}
}
Example #2
0
// RunInBackground a wrapper for runtime.RunInBackground
func RunInBackground(req *wcg.Request, f func(*wcg.Request)) {
	bgReq := req.Clone()
	runtime.RunInBackground(NewContext(req), func(ctx context.Context) {
		bgReq.SetLocal("__gaebg_context", ctx)
		f(bgReq)
	})
}