lib/scrivito/backend/obj_load.rb in scrivito_sdk-0.65.2 vs lib/scrivito/backend/obj_load.rb in scrivito_sdk-0.66.0.rc1

- old
+ new

@@ -18,24 +18,28 @@ overall_results = if missing_ids.blank? results_from_cache else - results_from_backend = revision.obj_mget_request(missing_ids) + raw_results = revision.obj_mget_request(missing_ids) - results_from_backend.each do |result| - if result - cache.write_obj(result["_id"], result) - end + results_from_backend = raw_results.map do |result| + ObjDataCache.convert_from_backend(result) end + results_from_backend.each_with_index do |result, index| + cache.write_obj(missing_ids[index], result) + end + results_from_cache.map do |result| result || results_from_backend.shift end end overall_results.map do |raw_data| - Backend::ObjDataFromRest.new(raw_data) if raw_data + if raw_data != ObjDataCache::NONEXISTENT_OBJ + Backend::ObjDataFromRest.new(raw_data) + end end end end end