Skip to content

Commit

Permalink
Merge branch 'support/3.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
dsuch committed Oct 28, 2024
2 parents 1232a34 + e77d547 commit 68c202e
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions code/zato-server/src/zato/server/file_transfer/observer/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@
# ################################################################################################################################
# ################################################################################################################################

# Ignore exceptions coming from locations that include these patterns
path_patters_to_ignore = [
'env/bin/python',
]

# ################################################################################################################################
# ################################################################################################################################

class PathCreatedEvent:
def __init__(self, src_path:'str', is_dir:'bool') -> 'None':
self.src_path = src_path
Expand Down Expand Up @@ -345,9 +353,20 @@ def observe_with_snapshots(
if self.is_local:
sleep(timeout) # type: ignore

except Exception:
logger.warning('Exception in %s file observer `%s` e:`%s (%s t:%s)',
self.observer_type_name, path, format_exc(), self.name, self.observer_type_impl)
except Exception as e:

# Reusable
e_str = str(e)

# Certain locations should be ignored ..
for item in path_patters_to_ignore:
if item in e_str:
break

# .. otherwise, we log what happened.
else:
logger.warning('Exception in %s file observer `%s` e:`%s (%s t:%s)',
self.observer_type_name, path, format_exc(), self.name, self.observer_type_impl)

if log_stop_event:
logger.warning('Stopped %s file transfer observer `%s` for `%s` (snapshot:%s/%s)',
Expand Down

0 comments on commit 68c202e

Please sign in to comment.