Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What can I do for DB Schema Awareness? #34

Closed
danhixon opened this issue Apr 9, 2014 · 2 comments
Closed

What can I do for DB Schema Awareness? #34

danhixon opened this issue Apr 9, 2014 · 2 comments

Comments

@danhixon
Copy link

danhixon commented Apr 9, 2014

Hi,
I have a postgres database with a multi tenant architecture. Each client gets their own set of tables inside their own schema. rpush is able to find the notifications because the ActiveRecord::Base.connection.schema_search_path is set properly but it can't seem to mark the records as delivered (it looks in the public schema by default and the table isn't there).
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "rapns_notifications" does not exist LINE 5: ...id = '"rapns_notifications"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum

/vendor/bundle/ruby/1.9.1/gems/rapns-3.4.1/lib/rapns/daemon/store/active_record.rb:45 in "mark_batch_delivered"
/vendor/bundle/ruby/1.9.1/gems/rapns-3.4.1/lib/rapns/daemon/batch.rb:81 in "complete_delivered"
/vendor/bundle/ruby/1.9.1/gems/rapns-3.4.1/lib/rapns/daemon/batch.rb:69 in "block in complete"
/vendor/bundle/ruby/1.9.1/gems/rapns-3.4.1/lib/rapns/daemon/batch.rb:67 in "each"
/vendor/bundle/ruby/1.9.1/gems/rapns-3.4.1/lib/rapns/daemon/batch.rb:67 in "complete"
/vendor/bundle/ruby/1.9.1/gems/rapns-3.4.1/lib/rapns/daemon/batch.rb:52 in "block in notification_processed"

I'm willing to patch but could you help point me in the right direction? I'm having trouble wrapping my little mind around the multi-threaded code here. Is there somewhere I can set an option or store a variable that will be accessible to all the threads?

Thanks in advance and thanks for this excellent ruby gem!

@ileitch
Copy link
Member

ileitch commented Jun 12, 2014

Sorry, I somehow missed this issue :(

If you're still interested, you'll likely want to change this method to handle the schema: https://github.com/rpush/rpush/blob/master/lib/rpush/daemon/store/active_record.rb#L64

@ileitch ileitch closed this as completed Jun 12, 2014
@ileitch ileitch reopened this Jun 12, 2014
@ileitch
Copy link
Member

ileitch commented Jun 21, 2014

Please open a new issue if you have any questions.

@ileitch ileitch closed this as completed Jun 21, 2014
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

No branches or pull requests

2 participants