mononoke: blobstore healer code cleanups

Summary:
Address nits from D16599270:
* use map instead of and_then
* use &[T] instead of &Vec[T]

Reviewed By: StanislavGlebik

Differential Revision: D16666838

fbshipit-source-id: ad0afa2d44d7a713409ac75bab599a35f5cf1a87
This commit is contained in:
Alex Hornby 2019-08-06 10:41:09 -07:00 committed by Facebook Github Bot
parent 16f19442a1
commit 6011988595

View File

@ -77,10 +77,10 @@ impl Healer {
.into_iter()
.filter_map(|(key, entries)| {
cloned!(ctx, sync_queue, blobstores, healing_deadline);
let entries = entries.collect();
let entries: Vec<_> = entries.collect();
let heal_opt =
heal_blob(ctx, sync_queue, blobstores, healing_deadline, key, &entries);
heal_opt.map(|fut| fut.and_then(|()| Ok(entries)))
heal_opt.map(|fut| fut.map(|()| entries))
})
.collect();
@ -110,7 +110,7 @@ fn heal_blob(
blobstores: Arc<HashMap<BlobstoreId, Arc<dyn Blobstore>>>,
healing_deadline: DateTime,
key: String,
entries: &Vec<BlobstoreSyncQueueEntry>,
entries: &[BlobstoreSyncQueueEntry],
) -> Option<impl Future<Item = (), Error = Error>> {
// This is needed as we load by key, and a given key may have entries both before and after
// the deadline. We leave the key rather than re-add to avoid entries always being too new.