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

3775 fix geocode shared table rw #4509

Merged
merged 3 commits into from
Jul 17, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/models/geocoding.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ def run!
rows_geocoded_before = table_service.owner.in_database.select.from(table_service.sequel_qualified_table_name).where(cartodb_georef_status: true).count rescue 0

self.run_geocoding!(processable_rows, rows_geocoded_before)
rescue => e
CartoDB.notify_exception(e)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add context information (table, user...)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll move all that code, when I put a proper logger #4417

raise e
ensure
user.reset_pooled_connections
end
Expand Down
9 changes: 8 additions & 1 deletion services/table-geocoder/lib/table_geocoder_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ def self.get(user, cartodb_geocoder_config, table_service, params = {})
# NOTE: This assumes it's being called from a Resque job
user.reset_pooled_connections

user_connection = user.in_database
if user == table_service.owner
user_connection = user.in_database
else
if !table_service.table_visualization.has_permission?(user, CartoDB::Visualization::Member::PERMISSION_READWRITE)
raise 'Insufficient permissions on table'
end
user_connection = table_service.owner.in_database
end

instance_config = cartodb_geocoder_config
.deep_symbolize_keys
Expand Down