FBGlobalTransformCache: retry 3 times, wait between retries

Summary: That should improve the hit rate a little bit, notably for the cache-filling script. On OSS side, this changeset only adds the sleep() function as `FBGlobalTransformCache` is not exposed.

Reviewed By: cpojer

Differential Revision: D5201196

fbshipit-source-id: c2d8e1a1b03edd9e7747b3202c574b0783f4117d
This commit is contained in:
Jean Lauliac 2017-06-08 09:35:03 -07:00 committed by Facebook Github Bot
parent 71275b4018
commit 795c436cb1
1 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,20 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @flow
*/
'use strict';
function sleep(duration: number): Promise<void> {
return new Promise(resolve => {
setTimeout(resolve, duration);
});
}
module.exports = sleep;