File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -110,6 +110,8 @@ def __init__(
110
110
except OSError :
111
111
self .uselocal = False
112
112
113
+ self ._io_client = None
114
+
113
115
gc .collect ()
114
116
115
117
def neo_status (self , value ):
@@ -341,8 +343,12 @@ def connect(self):
341
343
print ("Could not connect to internet" , error )
342
344
print ("Retrying in 3 seconds..." )
343
345
time .sleep (3 )
346
+ gc .collect ()
344
347
345
348
def _get_io_client (self ):
349
+ if self ._io_client is not None :
350
+ return self ._io_client
351
+
346
352
self .connect ()
347
353
348
354
try :
@@ -353,7 +359,8 @@ def _get_io_client(self):
353
359
"Adafruit IO secrets are kept in secrets.py, please add them there!\n \n "
354
360
) from KeyError
355
361
356
- return IO_HTTP (aio_username , aio_key , self ._wifi .requests )
362
+ self ._io_client = IO_HTTP (aio_username , aio_key , self ._wifi .requests )
363
+ return self ._io_client
357
364
358
365
def push_to_io (self , feed_key , data ):
359
366
"""Push data to an adafruit.io feed
You can’t perform that action at this time.
0 commit comments