~comcloudway/builds.sr.ht

5b4a40fc96a9714035ecd512e565decca2da292d — Conrad Hoffmann 1 year, 11 months ago 023637a
api: allow cancelling of orphaned jobs
1 files changed, 6 insertions(+), 1 deletions(-)

M api/graph/schema.resolvers.go
M api/graph/schema.resolvers.go => api/graph/schema.resolvers.go +6 -1
@@ 405,7 405,12 @@ func (r *mutationResolver) Cancel(ctx context.Context, jobID int) (*model.Job, e
		if err != nil {
			return err
		}
		if resp.StatusCode != 200 {

		// If the job was found like this in the database, but the
		// runner does not know about it, then something is wrong (e.g.
		// the runner crashed and rebooted). Go ahead and set it to
		// cancelled, so that it does not block anything.
		if resp.StatusCode != 200 && resp.StatusCode != 404 {
			return fmt.Errorf("Failed to cancel job")
		}