Skip to content

Commit 8df64d4

Browse files
small tweaks
1 parent 1006dd4 commit 8df64d4

File tree

3 files changed

+34
-10
lines changed

3 files changed

+34
-10
lines changed

internal_filesystem/lib/websocket_nostr_receive.py

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
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)])
@@ -26,20 +27,24 @@
2627
print(f"sending this: {message}")
2728

2829
def 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)

internal_filesystem/lib/websocket_raw_nostr_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def stress_test_thread():
4848
#wsapp.send_text('["REQ","index3",{"kinds":[9735]}]')
4949
#wsapp.send_text('["REQ","index3",{"kinds":[9735], "since": 1745086888}]')
5050
tosend = '["REQ","index3",{"kinds":[9735], "since": '
51-
tosend += str(round(time.time()-500))
51+
tosend += str(round(time.time()-100))
5252
#tosend += str(round(time.time()-2000))
5353
#tosend += str(round(time.time()-10000))
5454
tosend += '}]'

scripts/build_lvgl_micropython.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,20 @@ if [ "$target" == "esp32" ]; then
3030
# --dual-core-threads: disabled GIL, run code on both CPUs
3131
# --task-stack-size={stack size in bytes}
3232
# CONFIG_* sets ESP-IDF options
33-
# listing processes on the esp32:
33+
# listing processes on the esp32 still doesn't work because no esp32.vtask_list_threads() or something
3434
# CONFIG_FREERTOS_USE_TRACE_FACILITY=y
3535
# CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID=y
3636
# CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y
37+
#python3 make.py --ota --partition-size=4194304 --flash-size=16 esp32 BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT DISPLAY=st7789 INDEV=cst816s USER_C_MODULE="/home/user/sources/micropython-camera-API/src/micropython.cmake" CONFIG_FREERTOS_USE_TRACE_FACILITY=y CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID=y CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y "$manifest"
3738
python3 make.py --ota --partition-size=4194304 --flash-size=16 esp32 BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT DISPLAY=st7789 INDEV=cst816s USER_C_MODULE="/home/user/sources/micropython-camera-API/src/micropython.cmake" CONFIG_FREERTOS_USE_TRACE_FACILITY=y CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID=y CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y "$manifest"
38-
else
39+
elif [ "$target" == "unix" -o "$target" == "macos" ]; then
3940
if [ "$buildtype" == "prod" ]; then
4041
manifest="FROZEN_MANIFEST=/home/user/sources/PiggyOS/manifest_unix.py"
4142
fi
4243
# build for desktop
4344
python3 make.py "$target" DISPLAY=sdl_display INDEV=sdl_pointer INDEV=sdl_keyboard "$manifest"
45+
else
46+
echo "invalid target $target"
4447
fi
4548

4649
popd

0 commit comments

Comments
 (0)