Skip to content

Commit

Permalink
Use default_factory for relay policy field
Browse files Browse the repository at this point in the history
RelayPolicy is mutable, so needs to be insantiated in the dataclass by a
default_factory.

Fixes an error on startup with python 3.12.
  • Loading branch information
laanwj committed Aug 14, 2024
1 parent 37cb66b commit 5e92beb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nostr/relay.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json
import time
from dataclasses import dataclass
from dataclasses import dataclass, field
from queue import Queue
from threading import Lock
from typing import Optional
Expand Down Expand Up @@ -34,7 +34,7 @@ class RelayProxyConnectionConfig:
class Relay:
url: str
message_pool: MessagePool
policy: RelayPolicy = RelayPolicy()
policy: RelayPolicy = field(default_factory=RelayPolicy)
ssl_options: Optional[dict] = None
proxy_config: RelayProxyConnectionConfig = None

Expand Down

0 comments on commit 5e92beb

Please sign in to comment.