mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-11 14:41:10 +08:00
The test was flaky and failing with the following errors:
```
Failure/Error:
klass
.connection
.select_raw(relation.arel) do |result, _|
result.type_map = DB.type_map
result.nfields == 1 ? result.column_values(0) : result.values
end
NoMethodError:
undefined method `select_raw' for nil
./lib/freedom_patches/fast_pluck.rb:60:in `pluck'
./vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/relation/calculations.rb:354:in `pick'
./app/models/web_crawler_request.rb:27:in `request_id'
./app/models/web_crawler_request.rb:31:in `rescue in request_id'
./app/models/web_crawler_request.rb:26:in `request_id'
./app/models/web_crawler_request.rb:19:in `write_cache!'
./app/models/concerns/cached_counting.rb:135:in `block (3 levels) in flush_to_db'
./vendor/bundle/ruby/3.3.0/gems/rails_multisite-6.1.0/lib/rails_multisite/connection_management/null_instance.rb:49:in `with_connection'
./vendor/bundle/ruby/3.3.0/gems/rails_multisite-6.1.0/lib/rails_multisite/connection_management.rb:21:in `with_connection'
./app/models/concerns/cached_counting.rb:134:in `block (2 levels) in flush_to_db'
./app/models/concerns/cached_counting.rb:124:in `each'
./app/models/concerns/cached_counting.rb:124:in `block in flush_to_db'
./lib/distributed_mutex.rb:53:in `block in synchronize'
./lib/distributed_mutex.rb:49:in `synchronize'
./lib/distributed_mutex.rb:49:in `synchronize'
./lib/distributed_mutex.rb:34:in `synchronize'
./app/models/concerns/cached_counting.rb:120:in `flush_to_db'
./app/models/concerns/cached_counting.rb:187:in `perform_increment!'
./app/models/web_crawler_request.rb:15:in `increment!'
./lib/middleware/request_tracker.rb:74:in `log_request'
./lib/middleware/request_tracker.rb:409:in `block in log_later'
./lib/scheduler/defer.rb:125:in `block in do_work'
./vendor/bundle/ruby/3.3.0/gems/rails_multisite-6.1.0/lib/rails_multisite/connection_management/null_instance.rb:49:in `with_connection'
./vendor/bundle/ruby/3.3.0/gems/rails_multisite-6.1.0/lib/rails_multisite/connection_management.rb:21:in `with_connection'
./lib/scheduler/defer.rb:119:in `do_work'
./lib/scheduler/defer.rb:105:in `block (2 levels) in start_thread'
```
This was due to running the defer thread in an async manner which is
actually no representative of the production environment. It also
revealed a spot in our code base where writes are happening in a GET
request which can cause requests to fail if ActiveRecord is in readonly
mode.
|
||
|---|---|---|
| .. | ||
| activerecord_preventing_writes_spec.rb | ||
| api_keys_spec.rb | ||
| auto_reject_reviewable_users_spec.rb | ||
| blocked_hotlinked_media_spec.rb | ||
| category_tag_spec.rb | ||
| content_security_policy_spec.rb | ||
| discord_omniauth_spec.rb | ||
| email_outbound_spec.rb | ||
| email_style_spec.rb | ||
| facebook_omniauth_spec.rb | ||
| flags_spec.rb | ||
| github_omniauth_spec.rb | ||
| group_spec.rb | ||
| invalid_request_spec.rb | ||
| invite_only_registration_spec.rb | ||
| message_bus_spec.rb | ||
| multisite_cookies_spec.rb | ||
| multisite_spec.rb | ||
| rate_limiting_spec.rb | ||
| request_tracker_spec.rb | ||
| same_ip_spammers_spec.rb | ||
| secure_uploads_spec.rb | ||
| smtp_spec.rb | ||
| spam_rules_spec.rb | ||
| tag_counts_spec.rb | ||
| topic_auto_close_spec.rb | ||
| topic_thumbnail_spec.rb | ||
| twitter_omniauth_spec.rb | ||
| watched_words_spec.rb | ||