k3s-io / kine

Run Kubernetes on MySQL, Postgres, sqlite, dqlite, not etcd.
Apache License 2.0
1.5k stars 228 forks source link

enhance ttl events process logic #218

Closed gshilei closed 8 months ago

gshilei commented 9 months ago

enhance ttl events process logic

gshilei commented 9 months ago

I think this is a good change, but the retry needs to be moved outside this goroutine.

If the watch channel is closed, we may miss events if all we do is re-watch. We need to instead both list (to find things that we missed) and watch (to find new events in the future).

This could probably be as simple as moving the retry loop into the ttl(ctx context.Context) function down below.

I would also like to see an error-level log message emitted when this occurs.

I have moved the retry outside and added eventRecords sync-map to filter the repeated events. Thank you for taking the time to review.

gshilei commented 9 months ago

I think this is a good change, but the retry needs to be moved outside this goroutine.

If the watch channel is closed, we may miss events if all we do is re-watch. We need to instead both list (to find things that we missed) and watch (to find new events in the future).

This could probably be as simple as moving the retry loop into the ttl(ctx context.Context) function down below.

I would also like to see an error-level log message emitted when this occurs.

Hi @brandond ,

Please help check whether the current changes are ok. If there are other problems, I would like to continue to make the changes you expect. Thanks.