mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
16 lines
363 B
JavaScript
16 lines
363 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import RSVP from 'rsvp';
|
|
|
|
// An always failing promise used to race against other promises
|
|
export default function timeout(duration) {
|
|
return new RSVP.Promise((resolve, reject) => {
|
|
setTimeout(() => {
|
|
reject(`Timeout of ${duration}ms exceeded`);
|
|
}, duration);
|
|
});
|
|
}
|