Add product-drop-timeout parameter - #165
Conversation
|
|
||
| // NewService creates a service struct, containing all that is needed for a mmsd server to run. | ||
| func NewService(templates *template.Template, eventsDB *sql.DB, stateDB *sql.DB, natsURL string) *Service { | ||
| func NewService(templates *template.Template, eventsDB *sql.DB, stateDB *sql.DB, natsURL string, productDropTimeout int) *Service { |
There was a problem hiding this comment.
I think its time to consider a config struct or something for NewService, as the parameter list to the function is getting pretty long.
There was a problem hiding this comment.
Agree, I felt I was trying to push it a bit too far yesterday, now I have it confirmed :)
| @@ -354,6 +359,8 @@ func startEventLoop(webService *server.Service) { | |||
| if err := webService.DeleteOldEvents(time.Now().AddDate(0, 0, -3)); err != nil { | |||
There was a problem hiding this comment.
Maybe purging events and unused products can be merged into one? So the api from the user of the service do not have to call both?
Like webService.CleanUpEvents, which again deletes old events and removes unused products?
There was a problem hiding this comment.
The idea was to have separate configuration of how long to keep events and how long to keep products in the monitoring. It might not be necessary when I am thinking about it. Probably it is easier for the user to deal with only 1 parameter.
Purpose of this PR is to address an issue when products keep hanging in the metrics part forever.
We have discussed whether the product status and monitoring should even be part of MMS, there were practical reasons for this as it was easier to maintain on a multi-user machine. We should re-visit this when going over to k8s. It might make sense to split it up and have the functionality as a different component or even a system. The same plan we have with NATS.
There was a problem hiding this comment.
Keeping two separate config values for product and old events might make sense, but my comment was more about having just one method call for doing cleanup and this method would handle both product and event cleanup. But if you think its better to keep both config values and cleanup method call separate I won't push it :)
No description provided.