Skip to content

Commit

Permalink
Remove stuff not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
corps committed Oct 11, 2023
1 parent f598902 commit 22d4ada
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions src/sentry/models/outbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,10 +466,6 @@ def prepare_next_from_shard(cls, row: Mapping[str, Any]) -> Self | None:
def key_from(self, attrs: Iterable[str]) -> Mapping[str, Any]:
return {k: _ensure_not_null(k, getattr(self, k)) for k in attrs}

def hash_from(self, attrs: Iterable[str]) -> int:
# a single 64 bit result of hashing the given attrs.
return mmh3.hash64(".".join(str(v) for v in (getattr(self, attr) for attr in attrs)))[0]

def selected_messages_in_shard(
self, latest_shard_row: OutboxBase | None = None
) -> models.QuerySet:
Expand Down Expand Up @@ -525,18 +521,6 @@ def save(self, **kwds: Any) -> None: # type: ignore[override]
metrics.incr("outbox.saved", 1, tags=tags)
super().save(**kwds)

@contextlib.contextmanager
def with_shard_lock(self, wait=True):
using: str = db.router.db_for_write(type(self))
with connections[using].cursor() as cursor:
try:
cursor.execute(
f"SELECT pg_advisory_lock(id) FROM {self._meta.db_table} WHERE ",
)
yield
finally:
pass

def lock_id(self, attrs: Iterable[str]) -> int:
# 64 bit integer that roughly encodes a unique, serializable lock identifier
return mmh3.hash64(".".join(str(getattr(self, attr)) for attr in attrs))[0]
Expand Down

0 comments on commit 22d4ada

Please sign in to comment.