From adcf6d56dd1795b7c71f79755fd4c13ab741eec6 Mon Sep 17 00:00:00 2001 From: Yang Chun Ung Date: Wed, 29 May 2024 23:27:14 +0900 Subject: [PATCH 1/2] Fill missing collection ids --- NineChronicles.DataProvider/RenderSubscriber.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/NineChronicles.DataProvider/RenderSubscriber.cs b/NineChronicles.DataProvider/RenderSubscriber.cs index 98f519a4..76646a5d 100644 --- a/NineChronicles.DataProvider/RenderSubscriber.cs +++ b/NineChronicles.DataProvider/RenderSubscriber.cs @@ -1401,7 +1401,11 @@ protected override Task ExecuteAsync(CancellationToken stoppingToken) var outputState = new World(_blockChainStates.GetWorldState(ev.OutputState)); var collectionSheet = outputState.GetSheet(); var avatar = MySqlStore.GetAvatar(activateCollection.AvatarAddress, true); - foreach (var (collectionId, materials) in activateCollection.CollectionData) + // check chain state ids to fill in missing collection data + var collectionState = outputState.GetCollectionState(activateCollection.AvatarAddress); + var existIds = avatar.ActivateCollections.Select(i => i.Id); + var targetIds = collectionState.Ids.Except(existIds); + foreach (var collectionId in targetIds) { var row = collectionSheet[collectionId]; var options = new List(); From 26c4026abded3a5cdafa716881f04c7f6e8e0018 Mon Sep 17 00:00:00 2001 From: Yang Chun Ung Date: Wed, 29 May 2024 23:44:12 +0900 Subject: [PATCH 2/2] log exception --- NineChronicles.DataProvider/RenderSubscriber.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/NineChronicles.DataProvider/RenderSubscriber.cs b/NineChronicles.DataProvider/RenderSubscriber.cs index 76646a5d..59b144da 100644 --- a/NineChronicles.DataProvider/RenderSubscriber.cs +++ b/NineChronicles.DataProvider/RenderSubscriber.cs @@ -1401,6 +1401,7 @@ protected override Task ExecuteAsync(CancellationToken stoppingToken) var outputState = new World(_blockChainStates.GetWorldState(ev.OutputState)); var collectionSheet = outputState.GetSheet(); var avatar = MySqlStore.GetAvatar(activateCollection.AvatarAddress, true); + // check chain state ids to fill in missing collection data var collectionState = outputState.GetCollectionState(activateCollection.AvatarAddress); var existIds = avatar.ActivateCollections.Select(i => i.Id); @@ -1433,6 +1434,10 @@ protected override Task ExecuteAsync(CancellationToken stoppingToken) MySqlStore.UpdateAvatar(avatar); } + else + { + Log.Error($"ActivateColleciton RenderSubscriber: {ev.Exception?.Message}"); + } }); return Task.CompletedTask;