File tree 1 file changed +4
-10
lines changed
1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -63,23 +63,17 @@ def handle_array(self, event):
63
63
seen_files = set ()
64
64
unique_array = []
65
65
66
- for item in self .array : # Loop through the array of files and process each one
66
+ for item in reversed ( self .array ) : # Loop through the array of files and process each one
67
67
if item ['file' ] not in seen_files :
68
68
unique_array .append (item )
69
69
seen_files .add (item ['file' ])
70
70
71
- self .array = unique_array # Update the `array` attribute with the list of unique files
72
-
73
- for item in self .array :
74
- if item ['file' ] == event .src_path and item ['status' ] == 'processed' :
75
- return False
76
-
77
- for item in self .array :
78
71
if item ['file' ] == event .src_path :
72
+ if item ['status' ] == 'processed' :
73
+ return False
79
74
item ['status' ] = 'processed' # Mark the file as processed
80
75
81
- if len (self .array ) > 10 : # If the array has more than 10 items, remove the oldest ones
82
- self .array = self .array [- 10 :]
76
+ self .array = unique_array [- 10 :] # Keep the last 10 items in the array
83
77
84
78
return True
85
79
You can’t perform that action at this time.
0 commit comments