oldmoe / litestack

MIT License
1.02k stars 56 forks source link

Determine a "better solution" for avoiding workers in the Rails console #118

Open mattbnz opened 3 months ago

mattbnz commented 3 months ago

PR#99 merged a feature to prevent workers from running in the Rails console, but that was then disabled in later commits 0902676 and d191fb3 without much detail.

This bug is to track getting some details on what a "better solution" might look like - aka what was the issue encountered that required the feature being disabled again, and then the fix.

I'm happy to do some more work on this, but need details on what you'd like to see as the behaviour here.

oldmoe commented 2 months ago

Hi @mattbnz I have faced multiple issues in the benchmarks and tests that I had to retract it, I am weighing out some options and would like your input:

  1. Make it a global config option, e.g. auto_run: false and require explicit running (e.g. in an initializer)
  2. A specific config option for this use case auto_run_without_a_server: false
  3. Drop the auto running completely and always require an explicit start (either in an initializer or anywhere in the code)

3 seems like the most reasonable to me, given that an initializer can be created with the current generator and the experience remains largely the same without running in console surprises

Thoughts? other options?

mattbnz commented 2 months ago

Option 3 definitely seems the most attractive of those options, and is in-line with my experiences with other job queues which usually have to be explicitly started.

Sorry for not thinking about the test/benchmark use-cases up front, seems blatantly obvious in hindsight :)

Do you have a plan for how to do option 3 already, or would you welcome a PR with some thoughts?

Thanks.

oldmoe commented 2 months ago

Happy to accept a PR