-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: lighten retry logic for LightPush
- Loading branch information
Showing
5 changed files
with
67 additions
and
101 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
import type { IEncoder, IMessage } from "./message.js"; | ||
import { ProtocolUseOptions, SDKProtocolResult } from "./protocols.js"; | ||
import { SDKProtocolResult } from "./protocols.js"; | ||
|
||
export type ISenderOptions = { | ||
/** | ||
* Enables retry of a message that was failed to be sent. | ||
* @default false | ||
*/ | ||
autoRetry?: boolean; | ||
/** | ||
* Sets number of attempts if `autoRetry` is enabled. | ||
* @default 3 | ||
*/ | ||
maxAttempts?: number; | ||
}; | ||
|
||
export interface ISender { | ||
send: ( | ||
encoder: IEncoder, | ||
message: IMessage, | ||
sendOptions?: ProtocolUseOptions | ||
sendOptions?: ISenderOptions | ||
) => Promise<SDKProtocolResult>; | ||
} |
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,10 @@ | ||
// TODO: add them after decoupling `BaseProtocolSDK` from LightPush | ||
describe("LightPush SDK", () => { | ||
it("should fail to send if pubsub topics are misconfigured"); | ||
|
||
it("should fail to send if no connected peers found"); | ||
|
||
it("should send to number of used peers"); | ||
|
||
it("should retry on failure if specified"); | ||
}); |
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 was deleted.
Oops, something went wrong.