@ d dl Z d dlmZ d dlmZ d dlmZmZmZ d dl m Z mZ ej dd Z G d d ee ZdS ) N)config)MessageType)MessageSink MessageSourceexpect)recurring_checkScopeREAD_CONFIG_POLLING_INTERVAL c e Zd ZdZej Zd Zd Z e e j d Zd Z d Z ee d ZdS ) ConfigWatcherzSend ConfigUpdate message on [root's] config update. The config update is detected by polling config file's modification time. c ` t j | _ d| _ d | _ d | _ d S )Nr )r ConfigFile_config_last_notify_time_sink_task)selfs [/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/plugins/config_watcher.py__init__zConfigWatcher.__init__ s, (**!" c K dS )zplugins.MessageSink methodN )r loops r create_sinkzConfigWatcher.create_sink s r c $ K |d | _ d S )N timestamp)r r messages r on_config_update_messagez&ConfigWatcher.on_config_update_message! s ")!5r c p K || _ | | | _ d S N)r create_task _check_configr )r r sinks r create_sourcezConfigWatcher.create_source' s2 %%d&8&8&:&:;; r c | K | j +| j d c}| _ | | d {V d | _ d S r" )r cancelr )r ts r shutdownzConfigWatcher.shutdown+ sF :! JMAtz HHJJJGGGGGGG r c K t j | j r[t j | j t j }| j | d {V |d | _ d S d S )N)confr r ) r any_layer_modified_sincer r ConfigUpdater timer process_messager s r r$ zConfigWatcher._check_config2 s *4+ABB :!.\TY[[ G *,,W555555555 &-[%9D""" : :r N)__name__ __module____qualname____doc__r AVSCOPEr r r r r. r r&