Ë
    3ýjÞ]  ã                   ó>  — d dl Z d dlZd dlZd dlmZmZmZmZ d dlm	Z	m
Z
mZ d dlmZmZmZmZmZmZmZmZmZ d dlmZ erd dlmZ d dlmZ  ej8                  e«      Zeded   f   Zd	e d
dddfd„Z!de"de ez  ddfd„Z# G d„ d«      Z$ G d„ d«      Z% G d„ d«      Z&y)é    N)ÚTYPE_CHECKINGÚAnyÚ	AwaitableÚCallable)Úrecord_connection_handoffÚ!record_connection_relaxed_timeoutÚrecord_maint_notification_count)	ÚMaintenanceNotificationÚMaintenanceStateÚMaintNotificationsConfigÚNodeMovingNotificationÚOSSNodeMigratedNotificationÚOSSNodeMigratingNotificationÚ"_get_maintenance_notification_nameÚ"_get_maintenance_notification_typeÚ&_should_skip_connection_timeout_update)Úget_pool_name)ÚRedisCluster)Ú)AsyncMaintNotificationsAbstractConnection.ÚmessageÚtaskzasyncio.Task[Any]Úreturnc                 óŒ   — 	 |j                  «       }|rt        j	                  | |¬«       yy# t        j                  $ r Y yw xY w)aî  Task done-callback that surfaces a failed task's exception in the logs.

    Without it, an unhandled exception in a fire-and-forget task is only
    reported by asyncio as a noisy "Task exception was never retrieved"
    warning. Retrieving the exception here suppresses that warning and logs a
    meaningful error instead. Cancellation is expected and left unlogged.

    Bind ``message`` with ``functools.partial`` before passing to
    ``add_done_callback`` (which supplies ``task``).
    N)Úexc_info)Ú	exceptionÚasyncioÚCancelledErrorÚloggerÚerror)r   r   Úexcs      ú[/root/telegram-saas/.venv/lib/python3.12/site-packages/redis/asyncio/maint_notifications.pyÚ_log_task_exceptionr"   !   sG   € ðØ�n‰nÓˆñ Ü�‰�W sˆÕ+ð øô ×!Ñ!ò Ùðús   ‚- ­AÁAÚ
connectionÚnotificationc           
      ó¨  — t         j                  t        j                  «      sy d }	 t	        | dd «      }|r|j                  d«      nd }|rt        |«      dkD  r|d   nd }d }	 t	        | dd «      }t        |«      r |«       }t         j                  d|› d| › d|› d|› �«       y # t        t        t        f$ r Y ŒZw xY w# t        t        f$ r Y ŒMw xY w)	NÚ_writerÚsocknameé   Úget_resolved_ipz#Handling maintenance notification: ú, with connection: ú, connected to ip z, local socket port: )r   ÚisEnabledForÚloggingÚDEBUGÚgetattrÚget_extra_infoÚlenÚAttributeErrorÚOSErrorÚ	TypeErrorÚcallableÚdebug)r#   r$   Úsocket_addressÚwriterÚsocket_nameÚresolved_ipr)   s          r!   Úadd_debug_log_for_notificationr;   4   sö   € ô ×ÑœwŸ}™}Ô-Øà€NðÜ˜ Y°Ó5ˆÙ;A�f×+Ñ+¨JÔ7Àtˆá)¬c°+Ó.>ÀÒ.BˆK˜ŠNÈð 	ð €KðÜ! *Ð.?ÀÓFˆÜ�OÔ$Ù)Ó+ˆKô ‡L�LØ
-¨l¨^ð <Ø&˜<Ð'9¸+¸ð GØ,Ð-ð	/õøô œG¤YÐ/ò Ùðûô œGÐ$ò Ùðús#   ¨9B% Á$B? Â%B<Â;B<Â?CÃCc                   óÂ   — e Zd Zdededdfd„Z	 	 	 	 dd„Zdd„Zdd„Zd	e	ddfd
„Z
d	eddfd„Z	 ddedz  ddfd„Zd	eddfd„Zdedededdfd„Zdedededdfd„Zdd„Zy)Ú"AsyncMaintNotificationsPoolHandlerÚpoolÚconfigr   Nc                 óœ   — || _         || _        t        «       | _        t        «       | _        t        j                  «       | _        d | _        y ©N)	r>   r?   ÚsetÚ_processed_notificationsÚ_scheduled_tasksr   ÚLockÚ_lockr#   )Úselfr>   r?   s      r!   Ú__init__z+AsyncMaintNotificationsPoolHandler.__init__U   s:   € ð
 ˆŒ	ØˆŒÜFIÃeˆÔ%Ü9<»ˆÔÜ—\‘\“^ˆŒ
Ø&*ˆ�ó    c                 ó   — || _         y rA   )r#   )rG   r#   s     r!   Úset_connectionz1AsyncMaintNotificationsPoolHandler.set_connectiona   s   € ð %ˆ�rI   c                 óº   — t        | j                  | j                  «      }| j                  |_        | j                  |_        | j
                  |_        d |_        |S rA   )r=   r>   r?   rC   rD   rF   r#   )rG   Úcopys     r!   Úget_handler_for_connectionz=AsyncMaintNotificationsPoolHandler.get_handler_for_connectionf   sK   € ô 2°$·)±)¸T¿[¹[ÓIˆØ(,×(EÑ(EˆÔ%Ø $× 5Ñ 5ˆÔØ—Z‘ZˆŒ
ØˆŒØˆrI   c              ƒ   ó  K  — | j                   4 ƒd {  –—†  t        | j                  «      D ].  }|j                  «       sŒ| j                  j	                  |«       Œ0 d d d «      ƒd {  –—†  y 7 Œ[7 Œ# 1 ƒd {  –—†7  sw Y   y xY w­wrA   ©rF   ÚtuplerC   Ú
is_expiredÚremove©rG   r$   s     r!   Úremove_expired_notificationsz?AsyncMaintNotificationsPoolHandler.remove_expired_notificationsp   s�   è ø€ Ø—:‘:÷ 	Gñ 	GÜ % d×&CÑ&CÓ Dò G�Ø×*Ñ*Õ,Ø×1Ñ1×8Ñ8¸ÕFðG÷	G÷ 	Gñ 	Gøð 	Gø÷ 	G÷ 	Gñ 	GüóJ   ‚B“A/”B—)A3ÁA3ÁBÁ)A1Á*BÁ1BÁ3BÁ9A<Á:BÂBr$   c              ƒ   óÈ   K  — | j                  «       ƒ d {  –—†  t        |t        «      r| j                  |«      ƒ d {  –—†  y t        j                  d|› �«       y 7 ŒG7 Œ ­w©NúUnhandled notification type: )rU   Ú
isinstancer   Úhandle_node_moving_notificationr   r   rT   s     r!   Úhandle_notificationz6AsyncMaintNotificationsPoolHandler.handle_notificationv   sW   è ø€ Ø×/Ñ/Ó1×1Ð1ä�lÔ$:Ô;Ø×6Ñ6°|ÓD×DÑDä�L‰LÐ8¸¸ÐGÕHð 	2øð Eús    ‚A"–A—(A"¿A Á A"Á A"c           
   ƒ   ó€  K  — | j                   j                  s| j                   j                  «       sy | j                  4 ƒd {  –—†  || j                  v r	 d d d «      ƒd {  –—†  y t
        j                  t        j                  «      rNt
        j                  d|› d| j                  › d| j                  r| j                  j                  «       nd › �«       | j                  r| j                  j                  «       nd }| j                  j                  || j                   || j                   j                  xr |j                  d u¬«      ƒ d {  –—†  | j                   j                  r6|j                  €*| j!                  |j"                  dz  | j$                  |«       | j!                  |j"                  | j&                  |«       t)        t+        | j                  «      ¬«      ƒ d {  –—†  | j                  j-                  |«       d d d «      ƒd {  –—†  y 7 �ŒÙ7 �Œ½7 ŒÐ7 Œ87 Œ# 1 ƒd {  –—†7  sw Y   y xY w­w)Nz#Handling node MOVING notification: r*   r+   )r$   r?   Úmoving_address_srcÚrun_proactive_reconnecté   ©Ú	pool_name)r?   Úproactive_reconnectÚis_relaxed_timeouts_enabledrF   rC   r   r,   r-   r.   r6   r#   r)   Úgetpeernamer>   Úapply_moving_notificationÚnew_node_hostÚ	_scheduleÚttlr_   Úhandle_node_moved_notificationr   r   Úadd)rG   r$   r^   s      r!   r[   zBAsyncMaintNotificationsPoolHandler.handle_node_moving_notification~   sø  è ø€ ð —‘×/Ò/Ø—K‘K×;Ñ;Ô=àà—:‘:÷ 3	<ñ 3	<Ø˜t×<Ñ<Ñ<ð ÷3	<÷ 3	<ð 3	<ô ×"Ñ"¤7§=¡=Ô1Ü—‘Ø9¸,¸ð H(Ø(,¯©Ð'8Ð8JØ<@¿OºO�t—‘×6Ñ6Ô8ÐQUÐVðXôð 26·²�—‘×+Ñ+Ô-Àdð ð —)‘)×5Ñ5Ø)Ø—{‘{Ø#5à—K‘K×3Ñ3ò ?Ø$×2Ñ2¸$Ð>ð 6ó ÷ ð ð �{‰{×.Ò.°<×3MÑ3MÐ3UØ—‘Ø ×$Ñ$ qÑ(Ø×0Ñ0Ø&ôð �N‰NØ× Ñ Ø×3Ñ3Øôô ,Ü'¨¯	©	Ó2ô÷ ð ð ×)Ñ)×-Ñ-¨lÔ;÷g3	<÷ 3	<ñ 3	<ùð 3	<ùð0øð.øð_3	<ø÷ 3	<÷ 3	<ñ 3	<üsŒ   ‚AH>ÁHÁH>ÁH)ÁH>Á#H Á$H>Á)C)H)ÅH#ÅBH)Ç,H%Ç-H)ÈH>ÈH'ÈH>È H>È#H)È%H)È'H>È)H;È/H2È0H;È7H>r^   c              ƒ   óÔ   K  — | j                   4 ƒd{  –—†  | j                  j                  |¬«      ƒ d{  –—†  ddd«      ƒd{  –—†  y7 Œ97 Œ7 Œ	# 1 ƒd{  –—†7  sw Y   yxY w­w)zå
        Run proactive reconnect for the pool.
        Active connections are marked for reconnect after they complete the current command.
        Inactive connections are disconnected and will be connected on next use.
        N)r^   )rF   r>   r_   )rG   r^   s     r!   r_   z:AsyncMaintNotificationsPoolHandler.run_proactive_reconnect¼   sj   è ø€ ð —:‘:÷ 	ñ 	ð —)‘)×3Ñ3Ø#5ð 4ó ÷ ð ÷		÷ 	ñ 	øðøð		ø÷ 	÷ 	ñ 	üsS   ‚A(“A”A(— A·A¸A¼A(ÁAÁA(ÁAÁA(ÁA%ÁAÁA%Á!A(c           
   ƒ   ó0  K  — t        |«      }| j                  4 ƒd{  –—†  t        j                  t        j
                  «      rNt        j                  d|› d| j                  › d| j                  r| j                  j                  «       nd› �«       | j                  j                  «       }| j                  j                  }| j                  j                  |||¬«      ƒ d{  –—†  ddd«      ƒd{  –—†  y7 ŒÜ7 Œ7 Œ	# 1 ƒd{  –—†7  sw Y   yxY w­w)zN
        Handle the cleanup after a node moving notification expires.
        Nz5Reverting temporary changes related to notification: r*   r+   )Únotification_hashÚreset_relaxed_timeoutÚreset_host_address)ÚhashrF   r   r,   r-   r.   r6   r#   r)   r?   rd   rc   r>   Úcleanup_moving_notification)rG   r$   rn   ro   rp   s        r!   rj   zAAsyncMaintNotificationsPoolHandler.handle_node_moved_notificationÌ   sú   è ø€ ô ! Ó.Ðà—:‘:÷ 	ñ 	Ü×"Ñ"¤7§=¡=Ô1Ü—‘ØKÈLÈ>ð Z(Ø(,¯©Ð'8Ð8JØ<@¿OºO�t—‘×6Ñ6Ô8ÐQUÐVðXôð
 %)§K¡K×$KÑ$KÓ$MÐ!Ø!%§¡×!@Ñ!@Ðð
 —)‘)×7Ñ7Ø"3Ø&;Ø#5ð 8ó ÷ ð ÷	÷ 	ñ 	øðøð	ø÷ 	÷ 	ñ 	üsW   ‚DžC;ŸD¢CDÃ%C=Ã&DÃ*DÃ5C?Ã6DÃ=DÃ?DÄDÄD
ÄDÄDÚdelayÚcallbackÚargsc                 ón  — t        j                  «       j                  «       |z   }t        j                   | j                  ||g|¢­Ž «      }| j
                  j                  |«       |j                  | j
                  j                  «       |j                  t        j                  t        d«      «       y )Nz1Error handling scheduled maintenance notification)r   Úget_running_loopÚtimeÚcreate_taskÚ
_run_afterrD   rk   Úadd_done_callbackÚdiscardÚ	functoolsÚpartialr"   )rG   rs   rt   ru   Údeadliner   s         r!   rh   z,AsyncMaintNotificationsPoolHandler._scheduleç   s’   € ô ×+Ñ+Ó-×2Ñ2Ó4°uÑ<ˆÜ×"Ñ" ? 4§?¡?°8¸XÐ#MÈÒ#MÓNˆØ×Ñ×!Ñ! $Ô'Ø×Ñ˜t×4Ñ4×<Ñ<Ô=Ø×ÑÜ×ÑÜ#ØCóõ	
rI   r   c              ‡   ó¼   K  — |t        j                  «       j                  «       z
  }|dkD  rt        j                  |«      ƒ d {  –—†   ||Ž ƒ d {  –—†  y 7 Œ7 Œ­w)Nr   )r   rw   rx   Úsleep)rG   r   rt   ru   Ú	remainings        r!   rz   z-AsyncMaintNotificationsPoolHandler._run_afterú   sS   è ø€ ð œw×7Ñ7Ó9×>Ñ>Ó@Ñ@ˆ	Ø�qŠ=Ü—-‘- 	Ó*×*Ð*Ù˜ˆo×Ñð +øØús$   ‚AAÁAÁAÁAÁAÁAc              ƒ   ó¼   K  — | j                   sy t        | j                   «      }|D ]  }|j                  «        Œ t        j                  |ddiŽƒ d {  –—†  y 7 Œ­w)NÚreturn_exceptionsT)rD   rQ   Úcancelr   Úgather)rG   Útasksr   s      r!   Úcancel_scheduled_tasksz9AsyncMaintNotificationsPoolHandler.cancel_scheduled_tasks  sQ   è ø€ Ø×$Ò$ØÜ�d×+Ñ+Ó,ˆØò 	ˆDØ�K‰K�Mð	ä�n‰n˜eÐ<°tÑ<×<Ò<ús   ‚AAÁAÁA)r#   r   r   N)r   r=   ©r   NrA   )Ú__name__Ú
__module__Ú__qualname__r   r   rH   rK   rN   rU   r
   r\   r   r[   Ústrr_   rj   ÚfloatÚ_ScheduledCallbackrh   rz   rˆ   © rI   r!   r=   r=   T   sÿ   „ ð
+àð
+ð )ð
+ð 
ó	
+ð%ØEð%à	ó%ó
óGðIÐ6Mð IÐRVó Ið<<Ø2ð<<à	ó<<ð~ 04ñØ"%¨¡*ðà	óð Ø2ðà	óð6
àð
ð %ð
ð ð	
ð
 
ó
ð&	àð	ð %ð	ð ð		ð
 
ó	ô=rI   r=   c                   ó`   — e Zd Zdddeddfd„Zdefd„Zdeddfd	„Zd
e	deddfd„Z
deddfd„Zy)Ú(AsyncMaintNotificationsConnectionHandlerr#   r   r?   r   Nc                 ó    — || _         || _        y rA   )r#   r?   )rG   r#   r?   s      r!   rH   z1AsyncMaintNotificationsConnectionHandler.__init__  s   € ð
 %ˆŒØˆ�rI   c                 ó¢   — t        | j                  dd«      }|r"t        |dd«      rt        |j                  «      S t	        | j                  «      S )z‘
        Get the pool name from the connection's pool handler.
        Falls back to connection representation if pool is not available.
        Ú!_maint_notifications_pool_handlerNr>   )r/   r#   r   r>   Úrepr)rG   Úpool_handlers     r!   Ú_get_pool_namez7AsyncMaintNotificationsConnectionHandler._get_pool_name  sJ   € ô
 Ø�O‰OÐ@À$ó
ˆñ œG L°&¸$Ô?Ü  ×!2Ñ!2Ó3Ð3ä�D—O‘OÓ$Ð$rI   r$   c              ƒ   óÔ  K  — t        |«      }t        |«      }t        | j                  j                  | j                  j
                  | j                  j                  | j                  j
                  |¬«      ƒ d {  –—†  |€t        j                  d|› �«       y |r)| j                  t        j                  |«      ƒ d {  –—†  y | j                  |¬«      ƒ d {  –—†  y 7 Œe7 Œ"7 Œ	­w)N)Úserver_addressÚserver_portÚnetwork_peer_addressÚnetwork_peer_portÚmaint_notificationrY   )r$   )r   r   r	   r#   ÚhostÚportr   r   Ú%handle_maintenance_start_notificationr   ÚMAINTENANCEÚ)handle_maintenance_completed_notification)rG   r$   Únotification_typerž   s       r!   r\   z<AsyncMaintNotificationsConnectionHandler.handle_notification$  sÞ   è ø€ ä>¸|ÓLÐÜ?ÀÓMÐä-ØŸ?™?×/Ñ/ØŸ™×,Ñ,Ø!%§¡×!5Ñ!5Ø"Ÿo™o×2Ñ2Ø1ô
÷ 	
ð 	
ð Ð$Ü�L‰LÐ8¸¸ÐGÔHØáØ×<Ñ<Ü ×,Ñ,¨ló÷ ñ ð ×@Ñ@Ø)ð Aó ÷ ñ ð#	
øðøðús7   ‚A:C(Á<C"Á=AC(ÃC$ÃC(ÃC&ÃC(Ã$C(Ã&C(Úmaintenance_statec              ƒ   ó:  K  — t        | j                  |«       t        | j                  j                  | j                  «      ry || j                  _        | j                  j                  | j                  j                  ¬«       | j                  j                  | j                  j                  «       t        |t        «      r%| j                  j                  |j                  «       t        |«      }t        | j                  «       |d¬«      ƒ d {  –—†  y 7 Œ­w)N)Útmp_relaxed_timeoutT©Úconnection_namerž   Úrelaxed)r;   r#   r   r¥   r?   Úset_tmp_settingsÚrelaxed_timeoutÚupdate_current_socket_timeoutrZ   r   Úadd_maint_start_notificationÚidr   r   r˜   )rG   r¥   r$   rž   s       r!   r¡   zNAsyncMaintNotificationsConnectionHandler.handle_maintenance_start_notification>  sÖ   è ø€ ô
 	' t§¡¸ÔEä1Ø�O‰O×-Ñ-¨t¯{©{ô
ð à,=ˆ�‰Ô)Ø�‰×(Ñ(Ø $§¡× ;Ñ ;ð 	)ô 	
ð 	�‰×5Ñ5°d·k±k×6QÑ6QÔRÜ�lÔ$@ÔAð �O‰O×8Ñ8¸¿¹ÔIä?ÀÓMÐÜ/Ø ×/Ñ/Ó1Ø1Øô
÷ 	
ò 	
ús   ‚DDÄDÄDÚkwargsc              ‹   ó  K  — t        | j                  j                  | j                  «      ry d }|j	                  d«      r|d   }t        | j                  |r|nd«       | j                  j                  d¬«       | j                  j                  d«       t        j                  | j                  _        | j                  j                  «        |r0t        |«      }t        | j                  «       |d¬«      ƒ d {  –—†  y y 7 Œ­w)Nr$   ÚMAINTENANCE_COMPLETEDT)ro   éÿÿÿÿFr¨   )r   r#   r¥   r?   Úgetr;   Úreset_tmp_settingsr­   r   ÚNONEÚreset_received_notificationsr   r   r˜   )rG   r°   r$   rž   s       r!   r£   zRAsyncMaintNotificationsConnectionHandler.handle_maintenance_completed_notification\  sâ   è ø€ ä1Ø�O‰O×-Ñ-¨t¯{©{ô
ð àˆØ�:‰:�nÔ%Ø! .Ñ1ˆLÜ&Ø�O‰O©\™\Ð?Vô	
ð 	�‰×*Ñ*ÀÐ*ÔFð 	�‰×5Ñ5°bÔ9Ü,<×,AÑ,Aˆ�‰Ô)ð 	�‰×4Ñ4Ô6áÜ!CÀLÓ!QÐÜ3Ø $× 3Ñ 3Ó 5Ø#5Øô÷ ñ ð ðús   ‚C:DÃ<DÃ=D)rŠ   r‹   rŒ   r   rH   r�   r˜   r
   r\   r   r¡   r   r£   r�   rI   r!   r’   r’     sy   „ ðà?ðð )ðð 
ó	ð% ó %ðÐ6Mð ÐRVó ð4
à+ð
ð .ð
ð 
ó	
ð<Èð ÐPTô rI   r’   c                   ó\   — e Zd ZdZdddeddfd„Zdd„Zd	eddfd
„Zd	eddfd„Z	d	e
ddfd„Zy)Ú!AsyncOSSMaintNotificationsHandleru0  
    Cluster-wide handler for OSS (open-source) cluster maintenance notifications.

    Reacts to SMIGRATED (slot migration completed) push notifications and
    triggers topology re-initialization via nodes_manager.initialize().

    Lock discipline: _lock is held across the whole pool mutation, including
    await initialize(), so the topology refresh and the subsequent connection
    marking/disconnect happen as one atomic operation â€” releasing the lock
    mid-mutation would let other tasks observe partial state.

    Re-entrancy is not a deadlock risk here even though asyncio.Lock is
    non-reentrant: initialize() may dispatch commands whose responses carry new
    push notifications, but handle_notification schedules the actual handling as
    a separate background task rather than calling into it inline, so the
    re-entrant arrival never tries to re-acquire the lock on this call stack.
    The cheap _in_progress/_processed dedup that gates that scheduling runs
    without the lock â€” those sets are only mutated from the single event loop.
    Úcluster_clientr   r?   r   Nc                 ó¬   — || _         || _        t        «       | _        t        «       | _        t        j                  «       | _        t        «       | _        y rA   )	rº   r?   rB   rC   Ú_in_progressr   rE   rF   Ú_background_tasks)rG   rº   r?   s      r!   rH   z*AsyncOSSMaintNotificationsHandler.__init__�  s>   € ð
 -ˆÔØˆŒÜFIÃeˆÔ%Ü:=»%ˆÔÜ—\‘\“^ˆŒ
Ü47³EˆÕrI   c              ƒ   ó  K  — | j                   4 ƒd {  –—†  t        | j                  «      D ].  }|j                  «       sŒ| j                  j	                  |«       Œ0 d d d «      ƒd {  –—†  y 7 Œ[7 Œ# 1 ƒd {  –—†7  sw Y   y xY w­wrA   rP   )rG   Úns     r!   rU   z>AsyncOSSMaintNotificationsHandler.remove_expired_notificationsœ  ss   è ø€ Ø—:‘:÷ 	<ñ 	<Ü˜4×8Ñ8Ó9ò <�Ø—<‘<•>Ø×1Ñ1×8Ñ8¸Õ;ð<÷	<÷ 	<ñ 	<øð 	<ø÷ 	<÷ 	<ñ 	<ürV   r$   c              ƒ   ó  K  — || j                   v s|| j                  v ry | j                   j                  |«       	 t        j                  «       j                  | j                  |«      «      }| j                  j                  |«       |j                  | j                  j                  «       |j                  t        j                  t        d«      «       y # t        $ r | j                   j                  |«       ‚ w xY w­w)Nz7Error handling maintenance notification background task)r¼   rC   rk   r   rw   ry   Ú_do_handle_notificationr½   r{   r|   r}   r~   r"   Ú	Exception)rG   r$   r   s      r!   r\   z5AsyncOSSMaintNotificationsHandler.handle_notification¢  sà   è ø€ ð ˜D×-Ñ-Ñ-Ø˜t×<Ñ<Ñ<àØ×Ñ×Ñ˜lÔ+ð	Ü×+Ñ+Ó-×9Ñ9Ø×,Ñ,¨\Ó:óˆDð ×"Ñ"×&Ñ& tÔ,Ø×"Ñ" 4×#9Ñ#9×#AÑ#AÔBØ×"Ñ"Ü×!Ñ!Ü'ØMóõøô ò 	Ø×Ñ×%Ñ% lÔ3Øð	üs   ‚9D¼BC ÃDÃ&C>Ã>Dc              ƒ   ó  K  — 	 t        |t        «      r| j                  |«      ƒ d {  –—†  nt        j	                  d|› �«       | j
                  j                  |«       y 7 Œ9# | j
                  j                  |«       w xY w­wrX   )rZ   r   Ú-handle_oss_maintenance_completed_notificationr   r   r¼   r|   rT   s     r!   rÁ   z9AsyncOSSMaintNotificationsHandler._do_handle_notificationÐ  sq   è ø€ ð		4Ü˜,Ô(CÔDØ×HÑHÈÓV×VÑVä—‘Ð<¸\¸NÐKÔLð
 ×Ñ×%Ñ% lÕ3ð Wùð ×Ñ×%Ñ% lÕ3üs,   ‚B„$A$ ¨A"©A$ ÁBÁ"A$ Á$BÂBc           
   ƒ   óä  K  — | j                  «       ƒ d {  –—†  | j                  4 ƒd {  –—†  || j                  v r	 d d d «      ƒd {  –—†  y t        j	                  t
        j                  «      rt        j                  d|› �«       g }t        «       }|j                  j                  «       D ]ª  \  }}|j                  dd«      \  }}| j                  j                  j                  |t        |«      ¬«      }|�|j!                  |«       |D ]H  }	|	j#                  «       D ]3  }
|
j                  dd«      \  }}|j%                  |t        |«      f«       Œ5 ŒJ Œ¬ | j                  j                  j'                  |¬«      ƒ d {  –—†  t        |«      }|j)                  | j                  j                  j*                  j-                  «       «      }|D �]Â  }d}||v rwt        |j.                  «      }|j0                  D ]#  }||vsŒt3        |d«       |j5                  «        Œ% t7        |j8                  › d|j:                  › �¬«      ƒ d {  –—†  d	}nFt        j	                  t
        j                  «      r#t        j                  d
|j<                  › d�«       || j                  j                  j*                  j-                  «       vsŒøt?        j@                  «       jC                  |jE                  «       «      }| jF                  j!                  |«       |jI                  | jF                  jJ                  «       |jI                  tM        jN                  tP        d«      «       |r�Œ–t7        |j8                  › d|j:                  › �¬«      ƒ d {  –—†  �ŒÅ | j                  j!                  |«       d d d «      ƒd {  –—†  y 7 �Œ²7 �Œ 7 �Œ„7 �ŒJ7 �Œ…7 ŒB7 Œ# 1 ƒd {  –—†7  sw Y   y xY w­w)Nz!Handling SMIGRATED notification: ú:r(   )rŸ   r    )Úadditional_startup_nodes_infoFzSMIGRATED - mark for reconnectra   TzSMIGRATED: Node z9 not affected by maintenance, skipping mark for reconnectzCError disconnecting free connections after maintenance notification))rU   rF   rC   r   r,   r-   r.   r6   rB   Únodes_to_slots_mappingÚitemsÚrsplitrº   Únodes_managerÚget_nodeÚintrk   ÚkeysÚappendÚ
initializeÚunionÚnodes_cacheÚvaluesÚ_freeÚ_connectionsr;   Úmark_for_reconnectr   rŸ   r    Únamer   rw   ry   Údisconnect_free_connectionsr½   r{   r|   r}   r~   r"   )rG   r$   rÇ   Úaffected_nodesÚsrc_addressÚdest_mappingsÚsrc_hostÚsrc_portÚsrc_nodeÚdest_mappingÚdest_addressÚ	dest_hostÚ	dest_portÚ	all_nodesÚcurrent_nodeÚhandoff_recordedÚfree_setÚconnr   s                      r!   rÄ   zOAsyncOSSMaintNotificationsHandler.handle_oss_maintenance_completed_notificationÞ  sæ  è ø€ ð ×/Ñ/Ó1×1Ð1à—:‘:÷ Y	<ñ Y	<ð ˜t×<Ñ<Ñ<Ø÷Y	<÷ Y	<ð Y	<ô ×"Ñ"¤7§=¡=Ô1Ü—‘Ð@ÀÀÐOÔPð -/Ð)Ü ›UˆNð ×4Ñ4×:Ñ:Ó<òñ ØØà%0×%7Ñ%7¸¸QÓ%?Ñ"�˜(Ø×.Ñ.×<Ñ<×EÑEØ!¬¨H«ð Fó �ð Ð'Ø"×&Ñ& xÔ0Ø$1ò �LØ(4×(9Ñ(9Ó(;ò ˜Ø/;×/BÑ/BÀ3ÈÓ/JÑ,˜	 9Ø5×<Ñ<Ø&¬¨I«Ð7õññðð$ ×%Ñ%×3Ñ3×>Ñ>Ø.Kð ?ó ÷ ð ô ˜NÓ+ˆIØ!Ÿ™Ø×#Ñ#×1Ñ1×=Ñ=×DÑDÓFóˆIð !*ó )�Ø#(Ð Ø >Ñ1ô  # <×#5Ñ#5Ó6�HØ ,× 9Ñ 9ò 6˜Ø xÒ/Ü:Ø $Ð&Fôð !×3Ñ3Õ5ð6ô 4Ø%1×%6Ñ%6Ð$7°q¸×9JÑ9JÐ8KÐ"Lô÷ ð ð (,Ñ$ä×*Ñ*¬7¯=©=Ô9ÜŸ™Ø.¨|×/@Ñ/@Ð.Að BJð Kôð
 !Ø×.Ñ.×<Ñ<×HÑH×OÑOÓQòRô #×3Ñ3Ó5×AÑAØ$×@Ñ@ÓBó�Dð ×*Ñ*×.Ñ.¨tÔ4Ø×*Ñ*¨4×+AÑ+A×+IÑ+IÔJØ×*Ñ*Ü!×)Ñ)Ü/ð7óôó ,Ü7Ø)5×):Ñ):Ð(;¸1¸\×=NÑ=NÐ<OÐ&Pô÷ ò ðO)ðV ×)Ñ)×-Ñ-¨lÔ;÷sY	<÷ Y	<ð Y	<ð 	2ùðY	<ùð Y	<ùðLùð(ùð6øðkY	<ø÷ Y	<÷ Y	<ñ Y	<üs¾   ‚O0–O—O0«O¬O0¯O¿O0Á
OÁO0ÁD7OÆOÆB OÈ	AOÉOÉA=OËBOÍ,(OÎOÎ"OÎ7O0ÏOÏO0ÏO0ÏO0ÏOÏOÏOÏO0ÏO-Ï!O$Ï"O-Ï)O0r‰   )rŠ   r‹   rŒ   Ú__doc__r   rH   rU   r
   r\   rÁ   r   rÄ   r�   rI   r!   r¹   r¹   {  sp   „ ñð(
:à&ð
:ð )ð
:ð 
ó	
:ó<ð,Ð6Mð ,ÐRVó ,ð\4Ø3ð4à	ó4ð^<Ø7ð^<à	ô^<rI   r¹   )'r   r}   r-   Útypingr   r   r   r   Ú$redis.asyncio.observability.recorderr   r   r	   Úredis.maint_notificationsr
   r   r   r   r   r   r   r   r   Úredis.observability.attributesr   Úredis.asyncio.clusterr   Úredis.asyncio.connectionr   Ú	getLoggerrŠ   r   r�   r�   r"   Úobjectr;   r=   r’   r¹   r�   rI   r!   ú<module>rñ      sÈ   ðÛ Û Û ß :Ó :÷ñ ÷

÷ 
õ 
õ 9áÝ2ÝRà	ˆ×	Ñ	˜8Ó	$€à˜c 9¨T¡?Ð2Ñ3Ð ð, ð ,Ð,?ð ,ÀDó ,ð&ØðàÐ/Ñ/ðð 
ó÷@w=ñ w=÷tjñ j÷ZA<ò A<rI   