@@ -78,48 +78,39 @@ def process(self):
78
78
with tempfile .TemporaryDirectory (
79
79
dir = self ._config .ingest_directory ()
80
80
) as tmpdir :
81
- # Only run the ingest if there is no poller lock file
82
- # This helps to prevent ingesting files while polling is
83
- # still running. This is only effective when the poller
84
- # and ingester are running on the same machine
85
- if os .path .isfile (poller_lock_file ) is False :
86
- # Copy files from cache to ingest
87
- files .move_yaml_files (cache_directory , tmpdir )
88
-
89
- # Parallel process the files
90
- setup_success = setup (tmpdir , self ._config )
91
-
92
- if bool (setup_success ) is True :
93
- # Populate the arguments
94
- arguments = [
95
- [
96
- IngestArgument (
97
- idx_zone = item .idx_zone ,
98
- data = item .data ,
99
- filepath = item .filepath ,
100
- config = item .config ,
101
- dns = self ._dns ,
102
- )
103
- ]
104
- for item in setup_success .zones
81
+ # ASYNC ARCHITECTURE: Allow ingester to run while poller is active
82
+ # Copy files from cache to ingest
83
+ files .move_yaml_files (cache_directory , tmpdir )
84
+
85
+ # Parallel process the files
86
+ setup_success = setup (tmpdir , self ._config )
87
+
88
+ if bool (setup_success ) is True :
89
+ # Populate the arguments
90
+ arguments = [
91
+ [
92
+ IngestArgument (
93
+ idx_zone = item .idx_zone ,
94
+ data = item .data ,
95
+ filepath = item .filepath ,
96
+ config = item .config ,
97
+ dns = self ._dns ,
98
+ )
105
99
]
100
+ for item in setup_success .zones
101
+ ]
106
102
107
- # Process the device independent zone data in the
108
- # database first
109
- if bool (arguments ) is True :
110
- pairmacips = self .zone (arguments )
103
+ # Process the device independent zone data in the
104
+ # database first
105
+ if bool (arguments ) is True :
106
+ pairmacips = self .zone (arguments )
111
107
112
- # Process the device dependent in the database second
113
- if bool (pairmacips ):
114
- self .device (arguments )
108
+ # Process the device dependent in the database second
109
+ if bool (pairmacips ):
110
+ self .device (arguments )
115
111
116
- # Cleanup
117
- self .cleanup (setup_success .event )
118
- else :
119
- log_message = f"""\
120
- Poller lock file { poller_lock_file } exists. Skipping processing of cache \
121
- files. Is the poller running or did it crash unexpectedly?"""
122
- log .log2info (1077 , log_message )
112
+ # Cleanup
113
+ self .cleanup (setup_success .event )
123
114
124
115
def zone (self , arguments ):
125
116
"""Ingest the files' zone data.
0 commit comments