Skip to content

Commit

Permalink
set instance retired when state is completed or errored
Browse files Browse the repository at this point in the history
  • Loading branch information
Filirom1 committed Dec 1, 2012
1 parent 2d1bd23 commit 91a98f4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions postgres/openruko_api/functions/update_state.pgsql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ BEGIN
INSERT INTO instance_state
(state, state_extra_info, transitioned_at, instance_id, dyno_id)
VALUES (p_state, '', NOW(), p_instance_id, p_dyno_id);

IF (p_state = 'completed' OR p_state = 'errored') THEN
UPDATE instance SET retired = true
WHERE id = p_instance_id;
END IF;

RETURN 1;

Expand Down

0 comments on commit 91a98f4

Please sign in to comment.