mirror of
https://github.com/aljazceru/BTCPayServerPlugins.git
synced 2025-12-17 07:34:24 +01:00
handle cancellation
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
<PropertyGroup>
|
||||
<Product>Nostr </Product>
|
||||
<Description>Allows you to verify your nostr account with NIP5 and zap like the rest of the crazies</Description>
|
||||
<Version>1.0.6</Version>
|
||||
<Version>1.0.7</Version>
|
||||
</PropertyGroup>
|
||||
<!-- Plugin development properties -->
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -74,7 +74,7 @@ public class LnurlDescriptionFilter : PluginHookFilter<string>
|
||||
return arg;
|
||||
}
|
||||
|
||||
var entry = _memoryCache.CreateEntry(Nip05Plugin.GetZapRequestCacheKey(invoiceId.ToString()));
|
||||
using var entry = _memoryCache.CreateEntry(Nip05Plugin.GetZapRequestCacheKey(invoiceId.ToString()));
|
||||
entry.AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(5);
|
||||
entry.SetAbsoluteExpiration(TimeSpan.FromMinutes(5));
|
||||
entry.SetValue(nostr);
|
||||
|
||||
@@ -43,7 +43,6 @@ public class Zapper : IHostedService
|
||||
{
|
||||
while (!cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
|
||||
if (_pendingZapEvents.Any())
|
||||
{
|
||||
_logger.LogInformation($"Attempting to send {_pendingZapEvents.Count} zap receipts");
|
||||
@@ -94,8 +93,16 @@ public class Zapper : IHostedService
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
await Task.Delay(100, waitingToken.Token);
|
||||
}
|
||||
catch (TaskCanceledException e)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user