mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 22:44:29 +01:00
try to better respect event ordering
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
<Version>1.0.2.5</Version>
|
<Version>1.0.2.6</Version>
|
||||||
<NoWarn>NU1701,CA1816,CA1308,CA1810,CA2208</NoWarn>
|
<NoWarn>NU1701,CA1816,CA1308,CA1810,CA2208</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -305,7 +305,10 @@ namespace BTCPayServer.HostedServices
|
|||||||
leases.Add(_EventAggregator.Subscribe<InvoiceEvent>(async e =>
|
leases.Add(_EventAggregator.Subscribe<InvoiceEvent>(async e =>
|
||||||
{
|
{
|
||||||
var invoice = await _InvoiceRepository.GetInvoice(null, e.InvoiceId);
|
var invoice = await _InvoiceRepository.GetInvoice(null, e.InvoiceId);
|
||||||
await SaveEvent(invoice.Id, e);
|
List<Task> tasks = new List<Task>();
|
||||||
|
|
||||||
|
// Awaiting this later help make sure invoices should arrive in order
|
||||||
|
tasks.Add(SaveEvent(invoice.Id, e));
|
||||||
|
|
||||||
// we need to use the status in the event and not in the invoice. The invoice might now be in another status.
|
// we need to use the status in the event and not in the invoice. The invoice might now be in another status.
|
||||||
if (invoice.FullNotifications)
|
if (invoice.FullNotifications)
|
||||||
@@ -315,20 +318,22 @@ namespace BTCPayServer.HostedServices
|
|||||||
e.Name == "invoice_failedToConfirm" ||
|
e.Name == "invoice_failedToConfirm" ||
|
||||||
e.Name == "invoice_markedInvalid" ||
|
e.Name == "invoice_markedInvalid" ||
|
||||||
e.Name == "invoice_failedToConfirm" ||
|
e.Name == "invoice_failedToConfirm" ||
|
||||||
e.Name == "invoice_completed"
|
e.Name == "invoice_completed" ||
|
||||||
|
e.Name == "invoice_expiredPaidPartial"
|
||||||
)
|
)
|
||||||
await Notify(invoice);
|
tasks.Add(Notify(invoice));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.Name == "invoice_confirmed")
|
if (e.Name == "invoice_confirmed")
|
||||||
{
|
{
|
||||||
await Notify(invoice);
|
tasks.Add(Notify(invoice));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (invoice.ExtendedNotifications)
|
if (invoice.ExtendedNotifications)
|
||||||
{
|
{
|
||||||
await Notify(invoice, e.EventCode, e.Name);
|
tasks.Add(Notify(invoice, e.EventCode, e.Name));
|
||||||
}
|
}
|
||||||
|
await Task.WhenAll(tasks.ToArray());
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user