Skip to content

feat: Credo mediator clean up cron job#86

Merged
esune merged 8 commits intoopenwallet-foundation:mainfrom
jamshale:credo-mediator-cleanup
Apr 6, 2026
Merged

feat: Credo mediator clean up cron job#86
esune merged 8 commits intoopenwallet-foundation:mainfrom
jamshale:credo-mediator-cleanup

Conversation

@jamshale
Copy link
Copy Markdown
Contributor

@jamshale jamshale commented Feb 25, 2026

This is a tool used to remove old mediated connections when the have become stale. It requires the mediator tag connections with a lastSeen tag. It was arguments for the length of time a connection has become stale, when to start the first cleanup and the amount of days to wait before running the cleanup again.

If a connection record is deleted from the mediator database the connection which used it will no longer work. The recipient agent will need to create a new mediated connection.

It also checks if the connection has queued messages. In this case it will not delete the mediation records.

Signed-off-by: jamshale <jamiehalebc@gmail.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a cron job tool for cleaning up stale mediated connections in a Credo mediator. The tool periodically removes connections that have been inactive for a configurable period, along with their associated records (DID records, mediation records, and push notification records).

Changes:

  • Added CredoMediatorCleanUp class that implements automated cleanup of inactive connections based on lastSeen or updatedAt timestamps
  • Integrated new mediator-cleanup strategy into the CLI with arguments for inactive threshold, start time, and interval
  • Updated documentation with usage instructions for the cleanup tool

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 12 comments.

File Description
askar_tools/credo_mediator_clean_up.py New module implementing the cleanup logic with cron scheduling functionality
askar_tools/main.py Added CLI arguments and integration for the mediator-cleanup strategy
askar_tools/README.md Added documentation section for the Credo Mediator Clean Up tool

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread askar_tools/credo_mediator_clean_up.py
Comment thread askar_tools/credo_mediator_clean_up.py Outdated
Comment thread askar_tools/credo_mediator_clean_up.py Outdated
Comment thread askar_tools/credo_mediator_clean_up.py Outdated
Comment thread askar_tools/credo_mediator_clean_up.py Outdated
Comment thread askar_tools/credo_mediator_clean_up.py
Comment thread askar_tools/README.md Outdated
Comment thread askar_tools/credo_mediator_clean_up.py
Comment thread askar_tools/__main__.py
Comment thread askar_tools/__main__.py Outdated
Signed-off-by: jamshale <jamiehalebc@gmail.com>
Signed-off-by: jamshale <jamiehalebc@gmail.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread askar_tools/README.md
Comment thread askar_tools/__main__.py
Comment thread askar_tools/__main__.py Outdated
Comment thread askar_tools/credo_mediator_clean_up.py Outdated
Comment thread askar_tools/credo_mediator_clean_up.py Outdated
Comment thread askar_tools/credo_mediator_clean_up.py Outdated
Comment thread askar_tools/__main__.py Outdated
Comment thread askar_tools/README.md Outdated
Signed-off-by: jamshale <jamiehalebc@gmail.com>
Signed-off-by: jamshale <jamiehalebc@gmail.com>
Signed-off-by: jamshale <jamiehalebc@gmail.com>
Signed-off-by: jamshale <jamiehalebc@gmail.com>
@jamshale jamshale requested a review from esune April 2, 2026 20:15
Copy link
Copy Markdown
Member

@esune esune left a comment

Choose a reason for hiding this comment

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

This is great work, thanks @jamshale !
Only a couple of questions/nitpicks before final approval.

As per our discussion, I am also thinking about having the cleanup funcrionality ported and incorporated as a feature of the Credo mediator itself to make it easier to maintain and discover since it would use the same tech stack as the mediator, and be closer to its code for future changes.

Comment thread askar_tools/tests/test_main.py
Comment thread askar_tools/credo_mediator_clean_up.py
…if missing

Signed-off-by: jamshale <jamiehalebc@gmail.com>
@esune esune merged commit 990aa98 into openwallet-foundation:main Apr 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants