File tree Expand file tree Collapse file tree 3 files changed +16
-11
lines changed Expand file tree Collapse file tree 3 files changed +16
-11
lines changed Original file line number Diff line number Diff line change 1010 - uses : actions/checkout@v2
1111 - uses : actions/setup-python@v1
1212 with :
13- python-version : 3.8
13+ python-version : 3.9
1414 - name : Install dependencies
1515 run : |
1616 python -m pip install --upgrade pip
3636 - uses : actions/checkout@v2
3737 - uses : actions/setup-python@v1
3838 with :
39- python-version : 3.8
39+ python-version : 3.9
4040 - name : Install dependencies
4141 run : |
4242 python -m pip install --upgrade pip
5757 - name : Set up Python
5858 uses : actions/setup-python@v1
5959 with :
60- python-version : 3.8
60+ python-version : 3.9
6161 - name : Install dependencies
6262 run : |
6363 python -m pip install --upgrade pip
7575 - uses : actions/setup-node@v3
7676 with :
7777 node-version : 16
78- - name : Building Wechaty-ui
78+ - name : Building Wechaty-ui
7979 id : build-ui
8080 run : |
8181 make ui
Original file line number Diff line number Diff line change @@ -293,13 +293,18 @@ def load(cls, room_id: str) -> Room:
293293 return room
294294
295295 @classmethod
296- def upload_cache (cls , room_id : str )-> None :
296+ def upload_cache (cls , room_id : str ) -> Room :
297297 """
298298 dynamic upload
299- clear the room_id of _pool and upload it use load
299+ clear the room_id from _pool and re-upload it using load
300+ Args:
301+ room_id: The Roo ID to refresh
302+ Return:
303+ Room:The refreshed room instance
300304 """
301- cls ._pool [room_id ] = None
302- cls .load (room_id )
305+ if room_id in cls ._pool :
306+ del cls ._pool [room_id ]
307+ return cls .load (room_id )
303308
304309 def __str__ (self ) -> str :
305310 """
Original file line number Diff line number Diff line change 9999
100100from wechaty .utils import timestamp_to_date , qr_terminal
101101
102-
103102log : logging .Logger = get_logger ('Wechaty' )
104103
105104DEFAULT_TIMEOUT = 300
@@ -472,7 +471,7 @@ async def start(self) -> None:
472471 loop = asyncio .get_event_loop ()
473472 loop .stop ()
474473
475- except Exception as e : # pylint: disable=broad-except
474+ except Exception as e : # pylint: disable=broad-except
476475 print (e )
477476
478477 async def restart (self ) -> None :
@@ -713,7 +712,8 @@ async def room_leave_listener(payload: EventRoomLeavePayload) -> None:
713712 async def room_topic_listener (payload : EventRoomTopicPayload ) -> None :
714713 log .info ('receive <room-topic> event <%s>' , payload )
715714
716- room : Room = self .Room .upload_cache (payload .room_id )
715+ self .Room .upload_cache (payload .room_id )
716+ room : Room = self .Room .load (payload .room_id )
717717 await room .ready ()
718718
719719 changer = self .Contact .load (payload .changer_id )
You can’t perform that action at this time.
0 commit comments