Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed randomized column ID generation to fix new cache keys #162

Merged
merged 1 commit into from
Dec 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions lib/dl_query_processing/dl_query_processing/column_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,19 @@ def __add__(self, other: ColumnRegistry) -> ColumnRegistry:
)
return result

def _generate_column_id(self, avatar_id: str, col_idx: int) -> str:
"""Generate a unique ID in a reproducible manner"""
if "#" in avatar_id:
# If for some reason contains "#" (which it really shouldn't),
# then go with a random ID, but this will effectively disable caches
return make_id()
return f"{avatar_id}#{col_idx}"

def register_avatar(self, avatar_id: AvatarId, source_id: SourceId) -> None:
self._avatar_source_map[avatar_id] = source_id
for col in self._db_columns:
for col_idx, col in enumerate(self._db_columns):
if col.source_id == source_id:
column_id = make_id()
column_id = self._generate_column_id(avatar_id=avatar_id, col_idx=col_idx)
self._column_ids[(avatar_id, col.name)] = column_id
self._columns[column_id] = AvatarColumn(
id=column_id,
Expand Down
Loading