Poll pending CultMesh receipts by advertised record
This commit is contained in:
parent
acb341021f
commit
7bde1011a1
2 changed files with 22 additions and 1 deletions
|
|
@ -56,6 +56,7 @@ namespace GameCult.Eve.UnityScene
|
|||
private EveProviderAdvertisementDocument? _advertisement;
|
||||
private EveAdvertisedSurface? _advertisedSurface;
|
||||
private CultMeshBodyPublicationResolver? _bodyResolver;
|
||||
private DateTime _nextReceiptPollUtc;
|
||||
|
||||
public EveUnityCultMeshLiveProviderTransport(
|
||||
string replicaPath,
|
||||
|
|
@ -141,6 +142,26 @@ namespace GameCult.Eve.UnityScene
|
|||
else if (document is EveCommandReceiptDocument receipt)
|
||||
PublishReceipt(receipt);
|
||||
}
|
||||
PollPendingReceipts();
|
||||
}
|
||||
|
||||
private void PollPendingReceipts()
|
||||
{
|
||||
if (_pendingCommandIds.Count == 0 || DateTime.UtcNow < _nextReceiptPollUtc)
|
||||
return;
|
||||
_nextReceiptPollUtc = DateTime.UtcNow.AddMilliseconds(250);
|
||||
var interaction = RequireWorldInteraction();
|
||||
if (string.IsNullOrWhiteSpace(interaction.ReceiptRecordRef))
|
||||
return;
|
||||
var receipts = _snapshot!
|
||||
.FetchDocumentsAsync<EveCommandReceiptDocument>(
|
||||
recordKeys: _pendingCommandIds
|
||||
.Select(commandId => ChildRecordKey(interaction.ReceiptRecordRef, commandId))
|
||||
.ToArray(),
|
||||
schemaIds: new[] { EveCommandReceiptDocument.SchemaId })
|
||||
.GetAwaiter().GetResult();
|
||||
foreach (var receipt in receipts)
|
||||
PublishReceipt(receipt);
|
||||
}
|
||||
|
||||
public void SubmitCommand(EveSurfaceCommandRequest request)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "org.gamecult.eve.unity-scene",
|
||||
"displayName": "Eve Unity Scene Lowering",
|
||||
"version": "0.3.13",
|
||||
"version": "0.3.14",
|
||||
"unity": "2021.3",
|
||||
"description": "Provider-agnostic Unity scene shell for gamecult.eve.surface.v1 interactive world surfaces.",
|
||||
"dependencies": {
|
||||
|
|
|
|||
Reference in a new issue