speed up loading and saving to redis that the move request are getting a answer when switching workers, strip data that neats to get recomuted every turn
Build and Push Docker Container / build-and-push (push) Successful in 4m49s

This commit is contained in:
2026-04-07 12:13:11 +02:00
parent f479541c04
commit f6e19e18e6
6 changed files with 58 additions and 7 deletions
+9
View File
@@ -202,3 +202,12 @@ class TemplateSnake:
def set_target_food(self, target_food:dict):
self.target_food = target_food
return True
def __getstate__(self):
state = self.__dict__.copy()
state['history'] = [] # strip history — grows per turn, not needed for moves
state.pop('game_board', None) # re-set at top of every choose_move; circular ref
state.pop('calculations', None) # re-initialised at top of every choose_move
state.pop('eat_the_snake_overwrite', None) # re-initialised at top of every choose_move
state.pop('kill_the_snake', None) # per-call transient
return state