Currently the expiration worker is run as part of the retrieval service.
While this is not having an impact on service performance it does introduce the possibility of a race condition.
This caused an issue where deleted OTKs were being counted multiple times. The issue has been resolved by using transactions but this caused a small increase in the number of DB connections needed.
Ideally this task should be handled by a microservice and run periodically during the day, it does not need to occur in the go microservices.
Description
Currently the expiration worker is run as part of the retrieval service.
While this is not having an impact on service performance it does introduce the possibility of a race condition.
This caused an issue where deleted OTKs were being counted multiple times. The issue has been resolved by using transactions but this caused a small increase in the number of DB connections needed.
Ideally this task should be handled by a microservice and run periodically during the day, it does not need to occur in the go microservices.
Expiration Server Code sits here: https://github.com/cds-snc/covid-alert-server/blob/master/pkg/workers/expiration.go
AC