@@ -84,33 +84,39 @@ export async function exposeWithRadiation(context: BotContext) {
8484}
8585
8686export async function runHalfLife ( context : BotContext ) {
87- log . info ( "Running half life" ) ;
87+ const logger = log . child ( { } , { msgPrefix : "runHalfLife" } ) ;
88+
89+ logger . info ( "Running half life" ) ;
8890
8991 const allWaste = await lootService . getLootsByKindId ( LootKindId . RADIOACTIVE_WASTE ) ;
9092
9193 // See: https://github.com/NullDev/CSZ-Bot/issues/470
9294 // We don't do /2 straigt away, so we can roll this out more slowly initially. We can increase this to 2 once we got this number down in general
9395 // Also, consider aligning this with the drop rate of radioactive waste, so we have that balanced
9496 const targetWasteCount = Math . ceil ( allWaste . length / 1.1 ) ;
97+ logger . info ( { targetWasteCount } , "targetWasteCount" ) ;
9598
9699 if ( targetWasteCount >= allWaste . length ) {
100+ logger . info ( "targetWasteCount >= allWaste.length, nothing to do" ) ;
97101 return ;
98102 }
99103
100104 const wasteToRemove = allWaste . sort ( ( ) => Math . random ( ) ) . slice ( targetWasteCount ) ;
101105 if ( wasteToRemove . length === 0 ) {
106+ logger . info ( "No waste to remove, nothing to do" ) ;
102107 return ;
103108 }
104109
105110 const leadTemplate = resolveLootTemplate ( LootKindId . BLEI ) ;
106111 if ( ! leadTemplate ) {
107- log . error ( "Could not resolve loot template for lead." ) ;
112+ logger . error ( "Could not resolve loot template for lead." ) ;
108113 return ;
109114 }
110115
111116 const replacedStats = new Map < Snowflake , number > ( ) ;
112117
113118 for ( const l of wasteToRemove ) {
119+ logger . info ( { lootId : l . id , winnerId : l . winnerId } , "Replacing loot" ) ;
114120 const replaced = await lootService . replaceLoot (
115121 l . id ,
116122 {
0 commit comments