Skip to content

Commit

Permalink
ActivityUpdaterJob->after_action: fix txn conflict
Browse files Browse the repository at this point in the history
Creating a post would update thredded user detail (incr post count),
but so does ActivityUpdaterJob (update last_seen_at).

If these happen the same time on SQLite3, the following error is thrown:

  SQLite3::BusyException: database is locked

Moving the schedule to after_action prevents this.
  • Loading branch information
glebm committed Nov 24, 2016
1 parent 9926053 commit 37ad930
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/thredded/posts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class PostsController < Thredded::ApplicationController
include ActionView::RecordIdentifier

helper_method :topic
before_action :update_user_activity
after_action :update_user_activity

after_action :verify_authorized

Expand Down

0 comments on commit 37ad930

Please sign in to comment.