File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -79,17 +79,23 @@ public function gc()
79
79
if (time () % 100 !== 0 ) {
80
80
return ;
81
81
}
82
- $ query = $ this ->query ()
82
+ $ purge = $ this ->find ()
83
+ ->select (['id ' ])
84
+ ->hydrate (false )
85
+ ->where (['requested_at <= ' => new \DateTime ('-2 weeks ' )])
86
+ ->extract ('id ' )
87
+ ->toArray ();
88
+
89
+ $ query = $ this ->Panels ->query ()
83
90
->delete ()
84
- ->where (['requested_at <= ' => new \ DateTime ( ' -2 weeks ' ) ]);
91
+ ->where (['request_id IN ' => $ purge ]);
85
92
$ statement = $ query ->execute ();
86
93
$ statement ->closeCursor ();
87
94
88
- $ existing = $ this ->find ()->select (['id ' ]);
89
-
90
- $ query = $ this ->Panels ->query ()
95
+ $ query = $ this ->query ()
91
96
->delete ()
92
- ->where (['request_id NOT IN ' => $ existing ]);
97
+ ->where (['id IN ' => $ purge ]);
98
+
93
99
$ statement = $ query ->execute ();
94
100
$ statement ->closeCursor ();
95
101
}
You can’t perform that action at this time.
0 commit comments