| Commit message (Collapse) | Author | Age | Lines |
|
|
|
| |
Fixes #1082.
|
|
|
|
|
|
| |
Add some notes on the logic and expectations around
InfoRequest.described_state and calculate_status and
InfoRequestEvent.described_state and calculated_state.
|
|
|
|
|
|
|
| |
Make sure that admin edits changing the described state of an info
request are reflected in the latest_status and status values of info
request events so that the info requests are retrieved correctly in
status-based searches.
|
|
|
|
|
|
|
|
| |
Update test expectations and add further test to explicitly show that we
want the described status from a status update to be propagated to a
preceding response, as well as being filled in in the status update
itself (which is mostly to deal with the case where there isn't a
preceding response). Make those changes to calculate_event_states
|
|\
| |
| |
| |
| |
| |
| | |
'openaustralia_github/tests_set_described_state' into rails-3-develop
Conflicts:
spec/models/info_request_spec.rb
|
| | |
|
| |
| |
| |
| | |
user classifies a request
|
| | |
|
|\ \
| | |
| | |
| | |
| | | |
Conflicts:
spec/models/info_request_spec.rb
|
| | |
| | |
| | |
| | |
| | |
| | | |
Conflicts:
spec/models/info_request_spec.rb
|
| | | |
|
|\ \ \
| | | |
| | | |
| | | | |
'openaustralia_github/more_info_on_report_request' into rails-3-develop
|
| | | | |
|
| | | | |
|
| | |/
| |/| |
|
|\ \ \
| | | |
| | | |
| | | | |
'openaustralia_github/inline_search_method_refactor' into rails-3-develop
|
| | | | |
|
| |/ / |
|
|\ \ \
| | | |
| | | |
| | | | |
'openaustralia_github/small_email_hash_refactor' into rails-3-develop
|
| |/ / |
|
|\ \ \
| |_|/
|/| |
| | | |
'openaustralia_github/remove_random_request_action' into rails-3-develop
|
| |/ |
|
|\ \
| |/
|/|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
Gemfile.lock
app/controllers/public_body_controller.rb
app/mailers/track_mailer.rb
app/views/request/_hidden_correspondence.html.erb
app/views/request/_sidebar.html.erb
app/views/request/hidden.html.erb
app/views/request/new_please_describe.html.erb
app/views/request/preview.html.erb
app/views/user/show.html.erb
config/environment.rb
config/routes.rb
spec/controllers/public_body_controller_spec.rb
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Fixes #336
There was an occasional deadlock when two emails for the
same request came in near-simultaneously; two processes
would be started via script/mailin, each to deal with one
email which are both updating the same InfoRequest.
The error would look like:
2013-04-07 09:19:03 BST [13398]: [2-1] DETAIL: Process 13398 waits for ShareLock on transaction 36193647; blocked by process 13397.
Process 13397 waits for ExclusiveLock on tuple (390,35) of relation 32918788 of database 32918687; blocked by process 13398.
Process 13398: UPDATE "info_requests" SET "updated_at" = '2013-04-07 08:19:02.139515', "awaiting_description" = 't' WHERE "id" = 156200
Process 13397: UPDATE "info_requests" SET "updated_at" = '2013-04-07 08:19:02.143624', "awaiting_description" = 't' WHERE "id" = 156200
This arose from the following section of code:
ActiveRecord::Base.transaction do
raw_email = RawEmail.new
incoming_message.raw_email = raw_email
incoming_message.info_request = self
incoming_message.save!
raw_email.data = raw_email_data
raw_email.save!
self.awaiting_description = true
params = { :incoming_message_id => incoming_message.id }
if !rejected_reason.empty?
params[:rejected_reason] = rejected_reason.to_str
end
self.log_event("response", params)
self.save!
end
Matthew Somerville explained what was happening here in the
issue report; to repeat his explanation from the bug report,
both processes enter the transaction block and acquire a
ShareLock on self with:
incoming_message.info_request = self
incoming_message.save!
However, in order to update the self.awaiting_description field
of the InfoRequest, with:
self.awaiting_description = true
[...]
self.save!
... the ShareLock needs to be upgraded to an ExclusiveLock,
but both will wait until the other's ShareLock is released,
which would only happen at the end of the transaction.
We can avoid this deadlock by using SELECT ... FOR UPDATE
for the row in info_requests. In Rails 3.2.0 there is
ActiveRecord support for this (via with_lock and lock! on
a model instance) but so as not to require upgrading rails,
I'm just using raw SQL.
|
| | |
|
|\|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
Gemfile
Gemfile.lock
app/controllers/admin_request_controller.rb
app/controllers/admin_track_controller.rb
app/controllers/request_controller.rb
app/controllers/services_controller.rb
app/helpers/link_to_helper.rb
app/mailers/request_mailer.rb
app/models/application_mailer.rb
app/models/info_request.rb
app/views/admin_censor_rule/edit.html.erb
app/views/admin_censor_rule/new.html.erb
app/views/admin_public_body/_form.html.erb
app/views/admin_public_body/_locale_selector.html.erb
app/views/admin_public_body/_one_list.html.erb
app/views/admin_public_body/edit.html.erb
app/views/admin_public_body/list.html.erb
app/views/admin_public_body/new.html.erb
app/views/admin_request/_incoming_message_actions.html.erb
app/views/admin_request/edit.html.erb
app/views/admin_request/edit_comment.html.erb
app/views/admin_request/edit_outgoing.html.erb
app/views/admin_request/list.html.erb
app/views/admin_request/list_old_unclassified.html.erb
app/views/admin_request/show.html.erb
app/views/admin_track/_some_tracks.html.erb
app/views/admin_track/list.html.erb
app/views/admin_user/edit.html.erb
app/views/admin_user/list.html.erb
app/views/admin_user/show.html.erb
app/views/general/_footer.html.erb
app/views/general/exception_caught.html.erb
app/views/help/contact.html.erb
app/views/layouts/default.html.erb
app/views/public_body/_alphabet.html.erb
app/views/request/_request_listing_single.html.erb
app/views/request/_sidebar.html.erb
app/views/request/new.html.erb
app/views/request/show.html.erb
app/views/request_mailer/external_response.rhtml
app/views/request_mailer/fake_response.rhtml
config/environment.rb
config/environments/production.rb
config/routes.rb
spec/controllers/admin_censor_rule_controller_spec.rb
spec/controllers/request_controller_spec.rb
spec/controllers/track_controller_spec.rb
spec/helpers/link_to_helper_spec.rb
spec/mailers/request_mailer_spec.rb
spec/models/info_request_spec.rb
spec/spec_helper.rb
spec/views/public_body/show.html.erb_spec.rb
spec/views/request/show.html.erb_spec.rb
vendor/plugins/rails_xss/lib/rails_xss/erubis.rb
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| | |
object but we want it saved as a String
|
| | |
|
| | |
|
| |
| |
| |
| | |
easier
|
| | |
|
| | |
|
|\|
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
Gemfile
Gemfile.lock
config/environment.rb
lib/i18n_fixes.rb
|
| |\ |
|
| | | |
|
| | | |
|
| | | |
|