Log the time it takes to save the game.

This commit is contained in:
Dan Albert 2022-01-24 17:58:35 -08:00
parent e80851b0a1
commit 32dd0f543a

View File

@ -1,12 +1,13 @@
from __future__ import annotations
import logging
import os
import pickle
import shutil
from pathlib import Path
from typing import Optional, TYPE_CHECKING
from game.profiling import logged_duration
if TYPE_CHECKING:
from game import Game
@ -54,6 +55,7 @@ def load_game(path: str) -> Optional[Game]:
def save_game(game: Game) -> bool:
with logged_duration("Saving game"):
try:
with open(_temporary_save_file(), "wb") as f:
pickle.dump(game, f)