File tree 1 file changed +15
-0
lines changed
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 48
48
STIX_EXT_OCTI_SCO = "extension-definition--f93e2c80-4231-4f9a-af8b-95c9bd566a82"
49
49
STIX_EXT_MITRE = "extension-definition--322b8f77-262a-4cb8-a915-1e441e00329b"
50
50
PROCESSING_COUNT : int = 4
51
+ MAX_PROCESSING_COUNT : int = 100
51
52
52
53
meter = metrics .get_meter (__name__ )
53
54
bundles_timeout_error_counter = meter .create_counter (
@@ -2489,6 +2490,20 @@ def import_item(
2489
2490
work_id : str = None ,
2490
2491
):
2491
2492
worker_logger = self .opencti .logger_class ("worker" )
2493
+ # Ultimate protection to avoid infinite retry
2494
+ if processing_count > MAX_PROCESSING_COUNT :
2495
+ if work_id is not None :
2496
+ item_str = json .dumps (item )
2497
+ self .opencti .work .report_expectation (
2498
+ work_id ,
2499
+ {
2500
+ "error" : "Max number of retries reached, please see error logs of workers for more details" ,
2501
+ "source" : (
2502
+ item_str if len (item_str ) < 50000 else "Bundle too large"
2503
+ ),
2504
+ },
2505
+ )
2506
+ return False
2492
2507
try :
2493
2508
self .opencti .set_retry_number (processing_count )
2494
2509
opencti_operation = self .opencti .get_attribute_in_extension (
You can’t perform that action at this time.
0 commit comments