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

/api/recentCrashes pagination #18

Open
tracernz opened this issue Oct 11, 2017 · 0 comments
Open

/api/recentCrashes pagination #18

tracernz opened this issue Oct 11, 2017 · 0 comments
Assignees

Comments

@tracernz
Copy link
Member

@dustin, currently no way to get older crashes, can we do something like this (totally untested/written in github comment editor 😁)?

func handleRecentCrashes(w http.ResponseWriter, r *http.Request) {
	c := appengine.NewContext(r)
	start, err := strconv.Atoi(r.FormValue("start"))
	if err != nil || start < 0 {
		start = 0
	}
	q := datastore.NewQuery("CrashData").Order("-timestamp").Offset(start).Limit(50)
	res := []CrashData{}
	if err := fillKeyQuery(c, q, &res); err != nil {
		log.Errorf(c, "Error fetching crash results: %v", err)
		http.Error(w, err.Error(), 500)
		return
	}

	mustEncode(c, w, r, res)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants