Skip to content

Commit

Permalink
Merge pull request #92 from Reskov/memory-leak
Browse files Browse the repository at this point in the history
cache cattrs converter to prevent memory leak
  • Loading branch information
alexanderjordanbaker authored May 22, 2024
2 parents 26f2682 + ba8aa6e commit 1c8573e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion appstoreserverlibrary/models/LibraryUtility.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) 2023 Apple Inc. Licensed under MIT License.

from enum import EnumMeta
from functools import lru_cache
from typing import Any, List, Type, TypeVar

from attr import Attribute, has, ib, fields
Expand Down Expand Up @@ -52,7 +53,8 @@ def __attrs_post_init__(self):
elif value is not None:
setattr(self, field, value)



@lru_cache(maxsize=None)
def _get_cattrs_converter(destination_class: Type[T]) -> cattrs.Converter:
c = cattrs.Converter()
attributes: List[Attribute] = fields(destination_class)
Expand Down

0 comments on commit 1c8573e

Please sign in to comment.