Skip to content

Commit

Permalink
Merge pull request #16377 from CartoDB/feature/sc-189175/sql-api-oom-…
Browse files Browse the repository at this point in the history
…errors-when-exporting-data

[sc189175] Add export timeout to users
  • Loading branch information
Shylpx committed Dec 29, 2021
2 parents 6704b14 + 2fd1b21 commit b8215b1
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 4 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Expand Up @@ -28,6 +28,7 @@ Development
- Disable email validation in DO Premium Subscriptions [#16309](https://github.com/CartoDB/cartodb/pull/16309)
- Invalidate sessions on 'session_salt' issue [#16376](https://github.com/CartoDB/cartodb/pull/16376)
- Hide sharing tab from viewer in on-premises [#16299](https://github.com/CartoDB/cartodb/pull/16299)
- Add timeout for SQL API exports [#16377](https://github.com/CartoDB/cartodb/pull/16377)
- Remove all references to Spatial Data Catalog and Kepler GL maps in on-premises [#16293](https://github.com/CartoDB/cartodb/pull/16293)
- Increase hard-limit of MAX_TABLES_PER_IMPORT [#16374](https://github.com/CartoDB/cartodb/pull/16374)
- Guard code for vizjson users [#16267](https://github.com/CartoDB/cartodb/pull/16267)
Expand Down
2 changes: 1 addition & 1 deletion app/models/carto/helpers/user_commons.rb
Expand Up @@ -42,7 +42,7 @@ module Carto::UserCommons
salesforce_datasource_enabled builder_enabled geocoder_provider isolines_provider
routing_provider engine_enabled mapzen_routing_quota
mapzen_routing_block_price soft_mapzen_routing_limit no_map_logo org_admin
user_render_timeout database_render_timeout frontend_version asset_host
user_render_timeout database_render_timeout export_timeout frontend_version asset_host
state rate_limit_id public_map_quota regular_api_key_quota
maintenance_mode private_map_quota public_dataset_quota]

Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/cartodb_central_synchronizable.rb
Expand Up @@ -115,7 +115,7 @@ def allowed_attributes_from_central(action)
salesforce_datasource_enabled viewer geocoder_provider
isolines_provider routing_provider engine_enabled builder_enabled
mapzen_routing_quota mapzen_routing_block_price soft_mapzen_routing_limit no_map_logo
user_render_timeout database_render_timeout state industry company phone job_role
user_render_timeout database_render_timeout export_timeout state industry company phone job_role
password_reset_token password_reset_sent_at maintenance_mode company_employees use_case private_map_quota
session_salt public_dataset_quota dashboard_viewed_at email_verification_token email_verification_sent_at)
end
Expand Down
3 changes: 2 additions & 1 deletion app/models/user.rb
Expand Up @@ -787,7 +787,8 @@ def save_metadata
'db', user_timeout,
'db_public', database_timeout,
'render', user_render_timeout,
'render_public', database_render_timeout
'render_public', database_render_timeout,
'export', export_timeout
save_rate_limits
end

Expand Down
2 changes: 1 addition & 1 deletion app/services/carto/user_metadata_export_service.rb
Expand Up @@ -50,7 +50,7 @@ module UserMetadataExportServiceConfiguration
mobile_gis_extension mobile_max_open_users mobile_max_private_users
viewer salesforce_datasource_enabled builder_enabled geocoder_provider isolines_provider routing_provider
github_user_id engine_enabled mapzen_routing_quota mapzen_routing_block_price soft_mapzen_routing_limit
no_map_logo org_admin last_name user_render_timeout database_render_timeout frontend_version
no_map_logo org_admin last_name user_render_timeout database_render_timeout export_timeout frontend_version
asset_host state company phone industry job_role password_reset_token password_reset_sent_at maintenance_mode
company_employees use_case private_map_quota session_salt public_dataset_quota
email_verification_token email_verification_sent_at
Expand Down
15 changes: 15 additions & 0 deletions db/migrate/20211122155410_add_export_timeout_to_users.rb
@@ -0,0 +1,15 @@
require 'carto/db/migration_helper'

# rubocop:disable Style/MixinUsage
include Carto::Db::MigrationHelper
# rubocop:enable Style/MixinUsage

migration(
proc do
# The 0 value means: "apply default export timeout" (defined by the SQL API)
add_column :users, :export_timeout, :integer, default: 0, null: false
end,
proc do
drop_column :users, :export_timeout
end
)
1 change: 1 addition & 0 deletions spec/factories/user_metadata_export.rb
Expand Up @@ -31,6 +31,7 @@ def self.full_export(params = {})
user_timeout: 300_000,
database_render_timeout: 0,
user_render_timeout: 0,
export_timeout: 0,
upgraded_at: nil,
map_view_block_price: nil,
geocoding_quota: 0,
Expand Down

0 comments on commit b8215b1

Please sign in to comment.