Is your feature request related to a problem? Please describe.
The email provider keeps send-state in a process-local sync.Map (emailRoutine) in both:
pkg/providers/email/email.go
pkg/providers/legacy/email/email.go
That map tracks per-id states such as initializing / sending / success / error so a reconcile can avoid starting a second send for the same email id. After StepStatusCache (#239 / #240) and the HTTP rate limiter (#247 / #249) moved onto github.com/kubevela/pkg/cache, this remaining sync.Map should use the same shared cache package for consistency.
Describe the solution you'd like
Migrate emailRoutine to github.com/kubevela/pkg/cache in both email packages:
- Replace
sync.Map with the shared cache API (Get / Put / Delete).
- Preserve send-once semantics: do not use a short TTL that can drop in-flight or recently-sent ids and cause duplicate emails. Prefer explicit Delete on completion / failure, or a TTL that is safely longer than any realistic send window only if still correct.
- Keep public email provider behavior unchanged.
- Add or extend unit tests for both non-legacy and legacy paths covering initializing / sending / success / error and no double-send.
Depends on a released github.com/kubevela/pkg version that includes the cache package used by #240 / #249.
Describe alternatives you've considered
- Keep
sync.Map indefinitely. Works today, but leaves another bespoke store outside the shared cache direction.
- Use entry-count LRU with aggressive eviction. Rejected unless keys stay pinned for the full send lifetime; eviction must not cause duplicate sends.
Additional context
Is your feature request related to a problem? Please describe.
The email provider keeps send-state in a process-local
sync.Map(emailRoutine) in both:pkg/providers/email/email.gopkg/providers/legacy/email/email.goThat map tracks per-id states such as
initializing/sending/success/ error so a reconcile can avoid starting a second send for the same email id. After StepStatusCache (#239 / #240) and the HTTP rate limiter (#247 / #249) moved ontogithub.com/kubevela/pkg/cache, this remainingsync.Mapshould use the same shared cache package for consistency.Describe the solution you'd like
Migrate
emailRoutinetogithub.com/kubevela/pkg/cachein both email packages:sync.Mapwith the shared cache API (Get/Put/Delete).Depends on a released
github.com/kubevela/pkgversion that includes the cache package used by #240 / #249.Describe alternatives you've considered
sync.Mapindefinitely. Works today, but leaves another bespoke store outside the shared cache direction.Additional context