Skip to content

Commit

Permalink
feat: use user@hostname for lock owner (faster than sts caller iden…
Browse files Browse the repository at this point in the history
…tity)
  • Loading branch information
mdwint committed Jan 1, 2024
1 parent 7fdba58 commit 4ea5d5b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion s3pypi/locking.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import abc
import datetime as dt
import getpass
import hashlib
import json
import logging
import socket
import time
from contextlib import contextmanager
from dataclasses import dataclass
Expand Down Expand Up @@ -66,7 +68,7 @@ def build(
log.debug("No locks table found. Locking disabled.")
return DummyLocker()

owner = session.client("sts").get_caller_identity()["Arn"]
owner = f"{getpass.getuser()}@{socket.gethostname()}"
return DynamoDBLocker(table, owner, cfg)

def __init__(self, table: Table, owner: str, cfg: LockerConfig):
Expand Down

0 comments on commit 4ea5d5b

Please sign in to comment.