Skip to content

Conversation

@Carminepo2
Copy link
Contributor

@Carminepo2 Carminepo2 commented Nov 21, 2025

Issue

Contesto / Perché

This PR adds anew cronjob m2m-events-ttl-cleaner with a psql script that removes old records from M2M event tables based on a configurable TTL (Time To Live) retention policy.

It automatically finds tables with event_timestamp column, skipping the ones who don't.
Added new ${NAMESPACE}_m2m_event_ttl_cleaner_user user with DELETE grant for all m2m events tables.

PSQL script tested locally.

Servizi / Scope impattati

  • dev

Checklist Tracciabilità

  • Branch contiene la Jira key
  • Titolo PR conforme (type(scope): descrizione (KEY))
  • Fix Version impostata in Jira
  • Label servizio applicate

Carminepo2 and others added 24 commits September 24, 2025 14:28
tag: "15-alpine"

command: ["/bin/sh", "-c"]
args:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my suggestion on using directly the postgres image was based on the assumption that the command would have been much easier (basically just the delete).

I appreciate your implementation, with consistent logging and almost zero maintenance for new tables (just be careful because the presence of a column is not a strong discriminator).
On the other side, bash syntax is quite difficult to maintain when parsed as string, and errors in the script may be found only at runtime.
If you prefer having this logic I suggest considering writing a node application instead.

Base automatically changed from feat(dev)/add-m2m-event-manifest to main November 25, 2025 10:03
@Carminepo2
Copy link
Contributor Author

Closed in favor of #439

@Carminepo2 Carminepo2 closed this Nov 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants