#279 Do not execute generation of compose which is not in 'wait' state.
Merged 4 years ago by jkaluza. Opened 4 years ago by jkaluza.
jkaluza/odcs rmtree-exception  into  master

@@ -167,6 +167,8 @@ 

      Generates the compose with id `compose_id`.

      """

      compose = get_odcs_compose(compose_id)

+     if compose.state != COMPOSE_STATES["wait"]:

+         raise RuntimeError("The 'generate_compose' called for compose not in 'wait' state: %r" % compose)

If this happens, will the compose be marked as failed? I wonder if we should just log a warning and return.

      compose.transition(COMPOSE_STATES["generating"], "Compose thread started")

      db.session.commit()

      backend_generate_compose(compose.id)

Lack of this check was causing issues during the PSI outages when RabbitMQ
went up and down.

When the RabbitMQ goes down and up while the backend is still processing
the message, the RabbitMQ will resend the message again. This means
we will receive the message twice in the backend.

This PR fixes it by checking that compose the message is about is
in 'wait' state before we start processing it.

If this happens, will the compose be marked as failed? I wonder if we should just log a warning and return.

No, the compose will remain in its current state.

Pull-Request has been merged by jkaluza

4 years ago