Skip to content

Commit

Permalink
chore: fix logging for data integration
Browse files Browse the repository at this point in the history
  • Loading branch information
limebell committed Mar 6, 2024
1 parent 57cb40c commit 18d5a53
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions Lib9c/Action/MigrateAgentAvatar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using Libplanet.Action;
using Libplanet.Action.State;
using Libplanet.Crypto;
using Nekoyume.Model.State;
using Nekoyume.Module;
using Serilog;
using static Lib9c.SerializeKeys;
Expand Down Expand Up @@ -43,7 +42,7 @@ public override IWorld Execute(IActionContext context)
context.UseGas(1);
var states = context.PreviousState;
var migrationStarted = DateTimeOffset.UtcNow;
Log.Debug("Migration in block index #{Index} started", context.BlockIndex);
Log.Debug("Migrating agent/avatar states in block index #{Index} started", context.BlockIndex);

const int maxAvatarCount = 3;
var avatarAddresses = Enumerable
Expand Down Expand Up @@ -71,9 +70,9 @@ public override IWorld Execute(IActionContext context)
Log.Debug("Deleting agent {Address} from legacy account", address);
states = states.SetLegacyState(address, null);
Log.Debug(
"Migrating agent {Address} finished in: {Elapsed}",
"Migrating agent {Address} finished in: {Elapsed} ms",
address,
DateTimeOffset.UtcNow - started);
(DateTimeOffset.UtcNow - started).Milliseconds);
}

foreach (var address in avatarAddresses)
Expand All @@ -97,16 +96,16 @@ public override IWorld Execute(IActionContext context)
states = states.SetLegacyState(address.Derive(LegacyQuestListKey), null);
states = states.SetLegacyState(address.Derive(LegacyWorldInformationKey), null);
Log.Debug(
"Migrating avatar {Address} finished in: {Elapsed}",
"Migrating avatar {Address} finished in: {Elapsed} ms",
address,
DateTimeOffset.UtcNow - started);
(DateTimeOffset.UtcNow - started).Milliseconds);
}

Log.Debug(
"Migration of {Count} agents in block index #{Index} finished in: {Elapsed}",
"Migrating {Count} agents in block index #{Index} finished in: {Elapsed} ms",
AgentAddresses.Count,
context.BlockIndex,
DateTimeOffset.UtcNow - migrationStarted);
(DateTimeOffset.UtcNow - migrationStarted).Milliseconds);
return states;
}
}
Expand Down

0 comments on commit 18d5a53

Please sign in to comment.