14878: Add comment.
authorTom Clegg <tclegg@veritasgenetics.com>
Tue, 28 May 2019 18:05:05 +0000 (14:05 -0400)
committerTom Clegg <tclegg@veritasgenetics.com>
Tue, 28 May 2019 18:05:05 +0000 (14:05 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg@veritasgenetics.com>

services/api/lib/update_priority.rb

index 8bf3e150d3ad119e4558f2fb78e8ad1b00d57c1a..c688ac008b44b21944e86b36cdb3abbb15273e12 100644 (file)
@@ -12,6 +12,11 @@ module UpdatePriority
   #
   # If container priority=0 but there are committed container requests
   # for it with priority>0, update priority.
+  #
+  # Normally, update_priority is a no-op if another thread/process is
+  # already updating. Test cases that need to check priorities after
+  # updating can force a (possibly overlapping) update in the current
+  # thread/transaction by setting the "nolock" flag. See #14878.
   def self.update_priority(nolock: false)
     if !File.owned?(Rails.root.join('tmp'))
       Rails.logger.warn("UpdatePriority: not owner of #{Rails.root}/tmp, skipping")