Skip to content

Commit

Permalink
fixed a bug for real?
Browse files Browse the repository at this point in the history
  • Loading branch information
ishefi committed Mar 29, 2022
1 parent 1036710 commit 9c5a3a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ async def secret_cache_key(self):
self._secret_cache_key = self._secret_cache_key_fmt.format(self.secret, self.date)
return self._secret_cache_key

def _get_secret_vector(self):
return self.vector_logic.get_vector(self.secret)
async def _get_secret_vector(self):
return await self.vector_logic.get_vector(self.secret)

def _iterate_all_wv(self):
return self.vector_logic.iterate_all()
Expand All @@ -133,7 +133,7 @@ async def set_secret(self, dry=False, force=False):
if wv.get('secret_date') is not None:
raise ValueError("This word was a secret in the past")

secret_vec = self._get_secret_vector()
secret_vec = await self._get_secret_vector()

nearest = []
async for word, vec in self._iterate_all_wv():
Expand Down
4 changes: 2 additions & 2 deletions scripts/set_secret.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ async def do_populate(mongo, redis, model, secret, date, force):
else:
logic = CacheSecretLogic(mongo, redis, secret, date)
await logic.set_secret(dry=True, force=force)
cache = [w[::-1] for w in await logic.cache[::-1]]
cache = [w[::-1] for w in (await logic.cache)[::-1]]
print(' ,'.join(cache))
print(cache[0])
for rng in (range(i, i+10) for i in [1, 50, 100, 300, 550, 750]):
Expand All @@ -95,7 +95,7 @@ async def do_populate(mongo, redis, model, secret, date, force):
return True
else:
secret = await get_random_word(mongo)
return do_populate(mongo, redis, model, secret, date, force)
return await do_populate(mongo, redis, model, secret, date, force)


async def get_random_word(mongo):
Expand Down

0 comments on commit 9c5a3a5

Please sign in to comment.