Commit fc20af9 1 parent 0a8ea33 commit fc20af9 Copy full SHA for fc20af9
File tree 1 file changed +5
-6
lines changed
src/siam/AbstractInterface
1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -19,9 +19,9 @@ abstract class CronBase
19
19
*/
20
20
public function __construct ()
21
21
{
22
- static ::$ runtimePath = dirname (__FILE__ );
22
+ if ( empty ( static :: $ runtimePath )) static ::$ runtimePath = dirname (__FILE__ );
23
23
// 判断是否为单一任务 是的话停止运行
24
- $ lockName = static ::$ runtimePath .DIRECTORY_SEPARATOR .md5 ( $ this ->rule () ).".txt " ;
24
+ $ lockName = static ::$ runtimePath .DIRECTORY_SEPARATOR .$ this ->rule ().".txt " ;
25
25
if ( static ::$ singleCron && file_exists ($ lockName ) ){
26
26
throw new \Exception ($ this ->rule () . " is single cron job " );
27
27
}
@@ -42,9 +42,8 @@ abstract function rule();
42
42
* @throws \Throwable
43
43
*/
44
44
public function run (){
45
- $ data = $ this ->before ();
46
-
47
45
try {
46
+ $ data = $ this ->before ();
48
47
$ res = $ this ->do ($ data );
49
48
}catch (\Throwable $ throwable ){
50
49
$ this ->clearClock ();
@@ -74,9 +73,9 @@ abstract function after($res = true);
74
73
75
74
private function clearClock ()
76
75
{
77
- $ lockName = static ::$ runtimePath .DIRECTORY_SEPARATOR .md5 ( $ this ->rule () ).".txt " ;
76
+ $ lockName = static ::$ runtimePath .DIRECTORY_SEPARATOR .$ this ->rule ().".txt " ;
78
77
if (file_exists ($ lockName )){
79
78
unlink ($ lockName );
80
79
}
81
80
}
82
- }
81
+ }
You can’t perform that action at this time.
0 commit comments