Description:
change lock syntax to be as of rails 4
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r635:58b977bcebf1 - - 1 file changed: 1 inserted, 1 deleted
@@ -45,13 +45,13 | |||||
|
45 | end |
|
45 | end |
|
46 |
|
46 | ||
|
47 | def self.get_inqueue_and_change_status(status) |
|
47 | def self.get_inqueue_and_change_status(status) |
|
48 | task = nil |
|
48 | task = nil |
|
49 | begin |
|
49 | begin |
|
50 | Task.transaction do |
|
50 | Task.transaction do |
|
51 |
- task = Task.where(status: Task::STATUS_INQUEUE). |
|
51 | + task = Task.where(status: Task::STATUS_INQUEUE).lock(true).first |
|
52 | if task!=nil |
|
52 | if task!=nil |
|
53 | task.status = status |
|
53 | task.status = status |
|
54 | task.save! |
|
54 | task.save! |
|
55 | end |
|
55 | end |
|
56 | end |
|
56 | end |
|
57 |
|
57 |
You need to be logged in to leave comments.
Login now