1010
1111#filters = Filters([Filter(authors=[<a nostr pubkey in hex>], kinds=[EventKind.TEXT_NOTE])])
1212#filters = Filters([Filter(authors="04c915daefee38317fa734444acee390a8269fe5810b2241e5e6dd343dfbecc9", kinds=[EventKind.TEXT_NOTE])])
13- #timestamp = round(time.time()-10)
14- timestamp = round (time .time ()- 100 )
13+ timestamp = round (time .time ()- 10 )
14+ #timestamp = round(time.time()) # going for zero events to check memory use
15+ #timestamp = round(time.time()-100)
1516#timestamp = round(time.time()-1000)
1617#timestamp = round(time.time()-5000)
1718#filters = Filters([Filter(authors="04c915daefee38317fa734444acee390a8269fe5810b2241e5e6dd343dfbecc9", kinds=[9735], since=timestamp)])
2627print (f"sending this: { message } " )
2728
2829def printevents ():
29-
30+ print ( "relaymanager" )
3031 relay_manager = RelayManager ()
32+ time .sleep (3 )
3133 #relay_manager.add_relay("wss://nostr-pub.wellorder.net")
34+ print ("relaymanager adding" )
3235 relay_manager .add_relay ("wss://relay.damus.io" )
36+ time .sleep (3 )
37+ print ("relaymanager subscribing" )
3338 relay_manager .add_subscription (subscription_id , filters )
34- time .sleep (2 ) # allow the connections to open
39+ time .sleep (3 ) # allow the connections to open
3540
3641 print ("opening connections" ) # after this, CPU usage goes high and stays there
3742 relay_manager .open_connections ({"cert_reqs" : ssl .CERT_NONE }) # NOTE: This disables ssl certificate verification
38- time .sleep (2 ) # allow the connections to open
43+ time .sleep (10 ) # allow the connections to open
3944
4045 print ("publishing:" )
4146 relay_manager .publish_message (message )
42- time .sleep (2 ) # allow the messages to send
47+ time .sleep (10 ) # allow the messages to send
4348
4449 print ("printing events:" )
4550 #while relay_manager.message_pool.has_events():
@@ -55,7 +60,23 @@ def printevents():
5560 relay_manager .close_connections ()
5661
5762# new thread so REPL stays available
58- _thread .stack_size (32 * 1024 )
63+ # 12KB crashes here:
64+ # opening connections
65+ # [DEBUG 408724546] Starting run_forever
66+ # [DEBUG 408724546] Starting _async_main
67+ # [DEBUG 408724546] Reconnect interval set to 0s
68+ # [DEBUG 408724546] Started callback processing task
69+ # [DEBUG 408724546] Main loop iteration: self.running=True
70+ # [DEBUG 408724546] Connecting to wss://relay.damus.io
71+ # [DEBUG 408724547] Using SSL with no certificate verification
72+ # 24KB is fine
73+ _thread .stack_size (18 * 1024 )
5974_thread .start_new_thread (printevents , ())
6075#printevents()
6176
77+
78+ import gc
79+ for _ in range (50 ):
80+ collect = gc .collect ()
81+ print (f"MEMFREE: { gc .mem_free ()} " )
82+ time .sleep (1 )
0 commit comments