Saga IAmStartedByMessages and RequestTimeout

I have a Saga created by StartSaga that requests a timeout in 1 hour

public Task Handle(StartSaga message, IMessageHandlerContext context)
{
  return RequestTimeout<MyTimeout>(context, TimeSpan.FromHours(1))
}

If the Saga is already running and another StartSaga is sent (same correlation key) I have 2 timeouts in a hour from the same Saga instance.

Is this expected?

I am using NSB 7.8.1 with RMQ and Outbox turned on.

I guess I expected that the framework would skip the second message, when the correlation key matches an already running instance. Is this behavior documented somewhere?

Isn’t it kind of dangerous, e.g. catching the Saga start date like this

public Task Handle(StartSaga message, IMessageHandlerContext context)
{
  Data.SagaStartTime = DateTime.Now;
}

Is the workaround to have a flag in Saga state and check if this is already set? And wouldn’t we always do this?

  Data.Started = True;

That’s the expected behavior. It might sound weird when there is only one message that can start the saga, but if there were multiple IAmStartedBy<>, then you want all the messages to be handled. So, yes, the correct usage is to check if it’s already started.

Thanks, that makes sense.