-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(all): retry and clean queue system (#77)
- fix: bug first call http scale 0 to 1 - feature: add clean queue system - refactor: upgrade dependencies - feature: retry pattern now configurable
- Loading branch information
1 parent
f9716ef
commit fda13cd
Showing
48 changed files
with
1,502 additions
and
458 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
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System.Text; | ||
using DotNext.IO; | ||
using DotNext.Runtime.Serialization; | ||
using DotNext.Text; | ||
|
||
namespace SlimData.Commands; | ||
|
||
public struct ListCallbackCommand : ISerializable<ListCallbackCommand> | ||
{ | ||
public const int Id = 15; | ||
|
||
public string Identifier { get; set; } | ||
public string Key { get; set; } | ||
|
||
public int HttpCode { get; set; } | ||
|
||
public long NowTicks { get; set; } | ||
|
||
public async ValueTask WriteToAsync<TWriter>(TWriter writer, CancellationToken token) where TWriter : notnull, IAsyncBinaryWriter | ||
{ | ||
var command = this; | ||
await writer.EncodeAsync(command.Identifier.AsMemory(), new EncodingContext(Encoding.UTF8, false), | ||
LengthFormat.LittleEndian, token).ConfigureAwait(false); | ||
await writer.EncodeAsync(command.Key.AsMemory(), new EncodingContext(Encoding.UTF8, false), | ||
LengthFormat.LittleEndian, token).ConfigureAwait(false); | ||
await writer.WriteLittleEndianAsync(HttpCode, token).ConfigureAwait(false); | ||
await writer.WriteLittleEndianAsync(NowTicks, token).ConfigureAwait(false); | ||
} | ||
|
||
long? IDataTransferObject.Length => Encoding.UTF8.GetByteCount(Identifier) + sizeof(int) + Encoding.UTF8.GetByteCount(Key) + sizeof(long); | ||
|
||
public static async ValueTask<ListCallbackCommand> ReadFromAsync<TReader>(TReader reader, CancellationToken token) where TReader : notnull, IAsyncBinaryReader | ||
{ | ||
var identifier = await reader.DecodeAsync( new DecodingContext(Encoding.UTF8, false), LengthFormat.LittleEndian, token: token).ConfigureAwait(false); | ||
var key = await reader.DecodeAsync( new DecodingContext(Encoding.UTF8, false), LengthFormat.LittleEndian, token: token).ConfigureAwait(false); | ||
|
||
return new ListCallbackCommand | ||
{ | ||
Identifier = identifier.ToString(), | ||
Key = key.ToString(), | ||
HttpCode = await reader.ReadLittleEndianAsync<Int32>(token).ConfigureAwait(false), | ||
NowTicks = await reader.ReadLittleEndianAsync<Int64>(token).ConfigureAwait(false) | ||
}; | ||
} | ||
} |
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.