Question: Move session trim into service/object

Open
#239 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
ruby
Domain
backend, database

Research direction

Start by reading the session-trimming task in lib/tasks/database.rake, especially lines 14-22, to understand the existing entry point and behavior. Determine whether that logic can be exposed for programmatic use without invoking the rake task, with completion demonstrated by calling it from a Solid Queue recurring job.

Written by the indexing model from the issue text.

Description

Hi 👋

Thanks a lot for maintaining this gem! ❤️

I have a question:
Would it make sense to move the logic for the session trim (db:sessions:trim) into a service/object, so it can also be used programmatically without invoking the rake task?

More specifically: I'd like to trim the sessions using a solid_queue recurring job, but solid_queue doesn't support (?) rake tasks to be invoked.

https://github.com/rails/activerecord-session_store/blob/a764bbef8f1a45e2d9266d8ab6c1f1a9e7e4b93a/lib/tasks/database.rake#L14-L22

Dominant language
Ruby
Stars
603
Forks
192
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rails/activerecord-session_store

All issues in rails/activerecord-session_store

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.