This will paginate from the most recent timestamp for the instance that least recently posted to CW Logs. We need to do it this way to avoid missing logs from laggards, but it means keeping a cache of "seen" messages to avoid printing duplicates.
This is suboptimal because:
Right now the cache of seen messages grows unbounded
If one instance in a group finishes command execution long before others, we'll always be paginating from its last message timestamp. This could be minutes, resulting in a lot of duplicated requests. We should remove instances from the lastTimestamps map a few seconds after their command invocation completion. (A few seconds to account for delayed CW Logs appearance)
Right now we have the following code:
https://github.com/glassechidna/gossm/blob/d236fcd4e9de63554d79919979e7e5eb66da31e0/pkg/gossm/client.go#L234-L241
This will paginate from the most recent timestamp for the instance that least recently posted to CW Logs. We need to do it this way to avoid missing logs from laggards, but it means keeping a cache of "seen" messages to avoid printing duplicates.
This is suboptimal because:
lastTimestamps
map a few seconds after their command invocation completion. (A few seconds to account for delayed CW Logs appearance)