Update public source
This commit is contained in:
@@ -13,9 +13,32 @@ class HandshakesRepository:
|
||||
method_id: str,
|
||||
method_version: int,
|
||||
limit: int | None,
|
||||
handshake_ids: list[int] | tuple[int, ...] | None = None,
|
||||
) -> list[sqlite3.Row]:
|
||||
if handshake_ids is not None and not handshake_ids:
|
||||
return []
|
||||
|
||||
id_filter = ""
|
||||
parameters: list[Any] = [
|
||||
method_id,
|
||||
method_version,
|
||||
method_id,
|
||||
method_version,
|
||||
]
|
||||
|
||||
if handshake_ids is not None:
|
||||
placeholders = ", ".join(
|
||||
"?" for _ in handshake_ids
|
||||
)
|
||||
id_filter = f"AND h.id IN ({placeholders})"
|
||||
parameters.extend(handshake_ids)
|
||||
|
||||
parameters.append(
|
||||
limit if limit is not None else -1
|
||||
)
|
||||
|
||||
return self._conn.execute(
|
||||
"""
|
||||
f"""
|
||||
SELECT
|
||||
h.id AS handshake_id,
|
||||
h.hash22000,
|
||||
@@ -45,16 +68,11 @@ class HandshakesRepository:
|
||||
AND r.method_version = ?
|
||||
AND r.status = 'ACTIVE'
|
||||
)
|
||||
{id_filter}
|
||||
ORDER BY h.id
|
||||
LIMIT ?
|
||||
""",
|
||||
(
|
||||
method_id,
|
||||
method_version,
|
||||
method_id,
|
||||
method_version,
|
||||
limit if limit is not None else -1,
|
||||
),
|
||||
parameters,
|
||||
).fetchall()
|
||||
|
||||
def get_method_statistics(
|
||||
|
||||
@@ -82,6 +82,7 @@ class JobIssuanceService:
|
||||
method_version: int,
|
||||
limit: int | None,
|
||||
client_id: str | None = None,
|
||||
handshake_ids: list[int] | tuple[int, ...] | None = None,
|
||||
) -> IssuedJob | None:
|
||||
if limit is not None and limit <= 0:
|
||||
raise ValueError("limit must be greater than zero")
|
||||
@@ -111,6 +112,7 @@ class JobIssuanceService:
|
||||
method_id,
|
||||
method_version,
|
||||
limit,
|
||||
handshake_ids,
|
||||
)
|
||||
|
||||
if not handshake_rows:
|
||||
|
||||
Reference in New Issue
Block a user