@@ -183,13 +183,6 @@ def publish_to_wis2(self, dataset: dict, url: str) -> None:
183
183
url = url
184
184
)
185
185
186
- if self .cache is not None :
187
- LOGGER .debug ('Checking for data update' )
188
- if self .cache .get (message ['properties' ]['data_id' ]) is not None :
189
- update_link = deepcopy (message ['links' ][0 ])
190
- update_link ['rel' ] = 'update'
191
- message ['links' ].append (update_link )
192
-
193
186
cache = dataset .get ('cache' , True )
194
187
if not cache :
195
188
LOGGER .info (f'Setting properties.cache={ cache } ' )
@@ -200,6 +193,13 @@ def publish_to_wis2(self, dataset: dict, url: str) -> None:
200
193
tokens = data_id .split ('/' )
201
194
message ['properties' ]['data_id' ] = '/' .join (tokens [2 :])
202
195
196
+ if self .cache is not None :
197
+ LOGGER .info (f"Checking for duplicate: { message ['properties' ]['data_id' ]} " ) # noqa
198
+ if self .cache .get (message ['properties' ]['data_id' ]) is not None :
199
+ update_link = deepcopy (message ['links' ][0 ])
200
+ update_link ['rel' ] = 'update'
201
+ message ['links' ].append (update_link )
202
+
203
203
LOGGER .info (json .dumps (message , indent = 4 ))
204
204
msg = (f'Publishing WIS2 notification message to '
205
205
f'host={ BROKER_HOSTNAME } , port={ BROKER_PORT } , topic={ topic } ' )
@@ -220,7 +220,7 @@ def publish_to_wis2(self, dataset: dict, url: str) -> None:
220
220
)
221
221
222
222
if self .cache is not None :
223
- LOGGER .debug ( ' Setting cache key' )
223
+ LOGGER .info ( f" Setting cache key for { message [ 'properties' ][ 'data_id' ] } " ) # noqa
224
224
self .cache .set (message ['properties' ]['data_id' ], 'published' ,
225
225
ex = CACHE_EXPIRY_SECONDS )
226
226
0 commit comments