-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
298d6c5
commit a7b7eb2
Showing
8 changed files
with
567 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# Changelog | ||
|
||
## Next | ||
|
||
* Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* -------------------- | ||
* got-resume module | ||
* Default backoff function | ||
* ------------------*/ | ||
|
||
'use strict'; | ||
|
||
// Exports | ||
|
||
/** | ||
* Default backoff function | ||
* 1 sec on first attempt, increasing exponentially, doubling each time. | ||
* On 10th attempt is 512 secs = 8.5 mins. | ||
* @param {number} attempt - Attempt number (starting at 1) | ||
* @returns {number} - Wait (in milliseconds) | ||
*/ | ||
module.exports = function(attempt) { | ||
return Math.pow(2, attempt - 1) * 1000; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* -------------------- | ||
* got-resume module | ||
* Errors | ||
* ------------------*/ | ||
|
||
'use strict'; | ||
|
||
// Exports | ||
class BaseError extends Error { | ||
constructor(message) { | ||
super(message); | ||
this.name = 'GotResumeError'; | ||
} | ||
} | ||
|
||
class OptionsError extends BaseError { | ||
constructor(message) { | ||
super(message); | ||
this.name = 'GotResumeOptionsError'; | ||
} | ||
} | ||
|
||
class TransferError extends BaseError { | ||
constructor(message) { | ||
super(message); | ||
this.name = 'GotResumeTransferError'; | ||
} | ||
} | ||
|
||
module.exports = { | ||
Error: BaseError, | ||
OptionsError, | ||
TransferError | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.