Skip to content

Commit

Permalink
gc freeze optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
djstrong committed Jan 15, 2024
1 parent e2c692c commit bd41a38
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 3 additions & 4 deletions api/nameguard/nameguard.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Union

from nameguard.our_ens import OurENS
from ens_normalize import ens_process, is_ens_normalized, ens_cure, DisallowedSequence
from ens_normalize import is_ens_normalized, ens_cure, DisallowedSequence

import requests
from label_inspector.inspector import Inspector
Expand Down Expand Up @@ -389,12 +389,11 @@ async def secure_primary_name(self, address: str, network_name: str) -> SecurePr
else:
nameguard_result = await self.inspect_name(network_name, domain)

result = ens_process(domain, do_normalize=True, do_beautify=True)
if result.normalized != domain:
if nameguard_result.normalization == Normalization.UNNORMALIZED:
status = SecurePrimaryNameStatus.UNNORMALIZED
impersonation_status = None
else:
display_name = result.beautified
display_name = nameguard_result.beautiful_name
status = SecurePrimaryNameStatus.NORMALIZED
primary_name = domain

Expand Down
4 changes: 4 additions & 0 deletions api/nameguard/web_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import gc
import json
import os
import time
Expand Down Expand Up @@ -562,3 +563,6 @@ async def inspect_grapheme_get(
import asyncio

asyncio.run(ng.inspect_name('mainnet', 'ni ck.eth'))


gc.freeze()

0 comments on commit bd41a38

Please sign in to comment.