mirror of
https://github.com/simon987/task_tracker.git
synced 2025-12-13 14:59:03 +00:00
Don't give rate limit delay when project is not found
This commit is contained in:
14
api/task.go
14
api/task.go
@@ -56,6 +56,13 @@ func (api *WebAPI) SubmitTask(r *Request) {
|
||||
}
|
||||
|
||||
reservation := api.ReserveSubmit(createReq.Project)
|
||||
if reservation == nil {
|
||||
r.Json(JsonResponse{
|
||||
Ok: false,
|
||||
Message: "Project not found",
|
||||
}, 404)
|
||||
return
|
||||
}
|
||||
delay := reservation.DelayFrom(time.Now()).Seconds()
|
||||
if delay > 0 {
|
||||
r.Json(JsonResponse{
|
||||
@@ -108,6 +115,13 @@ func (api *WebAPI) GetTaskFromProject(r *Request) {
|
||||
}
|
||||
|
||||
reservation := api.ReserveAssign(project)
|
||||
if reservation == nil {
|
||||
r.Json(JsonResponse{
|
||||
Ok: false,
|
||||
Message: "Project not found",
|
||||
}, 404)
|
||||
return
|
||||
}
|
||||
delay := reservation.DelayFrom(time.Now()).Seconds()
|
||||
if delay > 0 {
|
||||
r.Json(JsonResponse{
|
||||
|
||||
Reference in New Issue
Block a user