agola-io/agola

notification service: implement logic to start from the last run event triggered

alessandro-sorint opened this issue · 2 comments

Notification service receive run events from run service by api /runs/events and parameter startsequence=0, so it starts evry time from the last run events.
If the notification service is down it will lost some run events, so we can:

  • add a table where we save the last run event: I think is necessary only to save the sequence field
  • evry time first, the notification service, get the last run event from db and get the sequence
  • the notification service call the api /runs/events with the parameter startsequence=the sequence of the last run event
  • evry time the notification service receive a new run event, update the last event to db

It is needed the table lastrunevent with the field sequence: it contains the sequence of the last runevent processed

@sgotti if you agree in the same PR we need to fix the client of api /runs/events because it use the parameter startruneventid, but the runservice need startsequence. So we change it with startsequence.

sgotti commented

@sgotti if you agree in the same PR we need to fix the client of api /runs/events because it use the parameter startruneventid, but the runservice need startsequence. So we change it with startsequence.

ok. The client wasn't updated alongside the runservice api.