diff options
-rw-r--r-- | lib/mogilefs/mogilefs.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/mogilefs/mogilefs.rb b/lib/mogilefs/mogilefs.rb index 5f22152..cfbf082 100644 --- a/lib/mogilefs/mogilefs.rb +++ b/lib/mogilefs/mogilefs.rb @@ -250,10 +250,17 @@ class MogileFS::MogileFS < MogileFS::Client def list_keys_verbose(keys, block) # :nodoc: # emulate the MogileFS::Mysql interface, slowly... + ordered = keys.dup + ready = {} on_file_info = lambda do |info| Hash === info or raise info file_info_cleanup(info) - block.call(info["key"], info["length"], info["devcount"]) + + # deal with trackers with multiple queryworkers responding out-of-order + ready[info["key"]] = info + while info = ready.delete(ordered[0]) + block.call(ordered.shift, info["length"], info["devcount"]) + end end opts = { :domain => @domain } keys.each do |key| |