@@ -30,15 +30,18 @@ func NewAntivirusTrigger(broker Broker) *AntivirusTrigger {
3030
3131// Schedule starts listening for file creation and update events.
3232func (t * AntivirusTrigger ) Schedule () {
33+ t .log .Infof ("trigger antivirus: Starting antivirus trigger, subscribing to firehose" )
3334 sub := realtime .GetHub ().SubscribeFirehose ()
3435 defer sub .Close ()
3536 for {
3637 select {
3738 case e := <- sub .Channel :
3839 if t .match (e ) {
40+ t .log .Debugf ("trigger antivirus: matched event for domain %s, doctype %s" , e .Domain , e .Doc .DocType ())
3941 t .pushJob (e )
4042 }
4143 case <- t .unscheduled :
44+ t .log .Infof ("trigger antivirus: Stopping antivirus trigger" )
4245 return
4346 }
4447 }
@@ -93,19 +96,28 @@ func (t *AntivirusTrigger) hasContentChanged(e *realtime.Event) bool {
9396}
9497
9598func (t * AntivirusTrigger ) pushJob (e * realtime.Event ) {
99+ t .log .Debugf ("trigger antivirus: received event for domain %s, doctype %s, verb %s" , e .Domain , e .Doc .DocType (), e .Verb )
100+
96101 // Get instance to check if antivirus is enabled
97102 inst , err := instance .Get (e .Domain )
98103 if err != nil {
104+ t .log .Errorf ("trigger antivirus: could not get instance %s: %v" , e .Domain , err )
99105 return
100106 }
101107
102108 cfg := config .GetAntivirusConfig (inst .ContextName )
103- if cfg == nil || ! cfg .Enabled {
109+ if cfg == nil {
110+ t .log .Debugf ("trigger antivirus: no config for context %s" , inst .ContextName )
111+ return
112+ }
113+ if ! cfg .Enabled {
114+ t .log .Debugf ("trigger antivirus: disabled for context %s" , inst .ContextName )
104115 return
105116 }
106117
107118 doc , ok := e .Doc .(* vfs.FileDoc )
108119 if ! ok {
120+ t .log .Debugf ("trigger antivirus: event doc is not a FileDoc, type: %T" , e .Doc )
109121 return
110122 }
111123
0 commit comments