Open wdiechmann opened 4 days ago
hmm - changing it to
production:
adapter: solid_cable
connects_to:
database: cable
# writing: cable
# reading: cable
polling_interval: 0.1.seconds
message_retention: 1.day
only made everything worse:
2024-11-19T15:56:38.294460800Z β οΈ [DEPRECATION] Defining the `template` method on a Phlex component will not be supported in Phlex 2.0. Please rename `Superform::Rails::Components::SelectField#template` to `Superform::Rails::Components::SelectField#view_template` instead.
2024-11-19T15:56:38.537169627Z Exiting
2024-11-19T15:56:38.539241148Z /usr/local/bundle/ruby/3.3.0/bundler/gems/rails-c11312a91855/activerecord/lib/active_record/connection_handling.rb:99:in `block in connects_to': undefined method `each' for an instance of Symbol (NoMethodError)
2024-11-19T15:56:38.539284188Z
2024-11-19T15:56:38.539291188Z database_keys.each do |role, database_key|
2024-11-19T15:56:38.539296468Z ^^^^^
2024-11-19T15:56:38.539300988Z from /usr/local/bundle/ruby/3.3.0/bundler/gems/rails-c11312a91855/activerecord/lib/active_record/connection_handling.rb:98:in `each'
2024-11-19T15:56:38.539323028Z from /usr/local/bundle/ruby/3.3.0/bundler/gems/rails-c11312a91855/activerecord/lib/active_record/connection_handling.rb:98:in `connects_to'
What happens if you wrap https://github.com/rails/solid_cable/blob/c696aaa3f177b510cf7dffe525c4bb9916457320/app/models/solid_cable/message.rb#L14 in something like: ActiveRecord::Base.connected_to(role: :writing)
hmm - changing it to This made it worse because solid_cable still sees the connects_to but its empty so it errors
What happens if you wrap
in something like: ActiveRecord::Base.connected_to(role: :writing)
you mean - bundle open solid_cable and "patch" it? - how do I get that to stay when I kamal deploy
?
you mean - bundle open solid_cable and "patch" it?
yea
how do I get that to stay when I kamal deploy
You would need to fork the repo and then update your gemfile to point to your fork.
you mean - bundle open solid_cable and "patch" it?
yea
how do I get that to stay when I kamal deploy
You would need to fork the repo and then update your gemfile to point to your fork.
Rgr
If that doesnt work, can you create basic rails app with repro instructions and send it over and ill investigate further.
it's a wrap β€οΈ
but honestly - to me it "smells" duck-tape, second-hand pizzabox, and "real Italian virgin olive oil out'a Wuhan" or am I just picky?
Did that work?
Did that work?
yep - thx a lot - I knew it would 'cause I've done 2-3 like additions in my own repo, but that I had to go "upstream" did not sit well with me - anyways - I don't know how this is fixed but I sure don't like that "we" will have to litter the solid gems like this -
But, hey, perhaps that's totally ok - in any case: thank you again for reaching out and offering a quick fix β€οΈ
Ill reopen this and work on fix.
Ill reopen this and work on fix.
if you need someone to debug or validate - just yell π
@wdiechmann Ok put up https://github.com/rails/solid_cable/pull/48. Mind giving it a go?
update 20/11/2024 10:41 CET: what a rabbit hole this turns out to be π My Docker Desktop somehow had died under me (and as I only rarely consult the GUI I hadn't noticed!) Why - I don't know but kamal registry login
apparently cannot work if DD is defunc'ing - it's nothing to do with actually being logged in or not... Go figure
update 20/11/2024 8:40 CET: seems to be an issue with "docker login" ATM - so I'll have to postpone the test, but from the looks of it there's no big surprise
this whole 'role' thing, though, smells, to me, like it belongs somewhere else entirely - 'cause all inserts/updates/deletes would potentially taste the salty bitter tears right?
a bit under the weather - but no problem - give me 5-10min
@npezza93 it's good!
just remembered that this was not the first encounter! https://github.com/fractaledmind/activerecord-enhancedsqlite3-adapter/issues/19
We most def should attack this issue not by patching all calls to INSERT/UPDATE/DELETE - but that's just my 2cents π
What does your database.yml look like by chance? Im having trouble reproducing in a test case
I added a test case here https://github.com/rails/solid_cable/pull/48/files for reference @wdiechmann
Sorry - AFK - but will BRB π
@fractaledmind led me on my way with this -
my config/database.yml
looks like this:
...
production:
writer:
<<: *default
database: storage/production.sqlite3
reader:
<<: *default
database: storage/production.sqlite3
cache:
<<: *default
database: storage/production_cache.sqlite3
migrations_paths: db/cache_migrate
queue:
<<: *default
database: storage/production_queue.sqlite3
migrations_paths: db/queue_migrate
cable:
<<: *default
database: storage/production_cable.sqlite3
migrations_paths: db/cable_migrate
and my cable.yml
...
production:
adapter: solid_cable
connects_to:
database:
writing: cable
reading: cable
polling_interval: 0.1.seconds
message_retention: 1.day
weird i cant reproduce with that same setup. are you able to spin up a new minimal rails app that reproduces?
? - no - like I wrote - the fix (both the first and the somewhat more elegant second one) did the trick - my only concern is that there must be like 10-12 (at least) places all over the place where this would have to be duplicated which to me does not seem very DRY - and that's not counting other gems cutting their own 'deal' with the writing/reading/whatever they come up with - right?
sorry if that did no translate well enough - english is not my native tongue (danish born and bread) π
I added a test case here https://github.com/rails/solid_cable/pull/48/files for reference @wdiechmann
not sure activerecord-enhancedsqlite3-adapter
buys that one - if I'm not misreading it will rewrite and use 'writer' and 'reader' (and if configured otherwise I'm not sure how it operates - but in any case:
I would upvote a conclave between maintainers of Rails Core, solid_*, sqlite3, more addressing the read/write challenge and (possibly an agenda with room to consider) introducing the locker room accepting that the root cause in fighting concurrency is one of resource allocation more and SQL writing/reading less
I'm "on all the latest jazz" ie
Rails main (Rails 8.1.0.alpha) Ruby 3.3.3 activerecord (8.1.0.alpha c11312a) solid_cable 3.0.2 sqlite3 (2.2.0) activerecord-enhancedsqlite3-adapter (0.8.0)
Pushing the envelope I've separated the writing from the reading - that does not come cheap π - and currently I'm trying to work out why I get this error in my logs
Firstly I gueessed
config/cable.yml
but addingreading: cable
did not change her mind :/Currently my only comfort is that "production" is limited to myself and other family only π