File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ export class Utils {
101
101
}
102
102
103
103
private static checkExpiredFileLock ( file : string ) : void {
104
- const pp = `${ Utils . PathToFileLock } /${ file } ` ;
104
+ const pp = `${ Utils . PathToFileLock } /${ Config . getInstance ( ) . getServerPort ( ) } / ${ file } ` ;
105
105
if ( ! fs . existsSync ( pp ) ) {
106
106
return ;
107
107
}
@@ -125,22 +125,27 @@ export class Utils {
125
125
}
126
126
127
127
private static fileLock ( file : string ) : void {
128
- const fd = fs . openSync ( `${ Utils . PathToFileLock } /${ file } ` , 'wx' ) ;
128
+ const fd = fs . openSync ( `${ Utils . PathToFileLock } /${ Config . getInstance ( ) . getServerPort ( ) } / ${ file } ` , 'wx' ) ;
129
129
fs . closeSync ( fd ) ;
130
130
}
131
131
132
132
public static fileUnlock ( file : string ) : void {
133
- fs . unlinkSync ( `${ Utils . PathToFileLock } /${ file } ` ) ;
133
+ fs . unlinkSync ( `${ Utils . PathToFileLock } /${ Config . getInstance ( ) . getServerPort ( ) } / ${ file } ` ) ;
134
134
}
135
135
136
136
public static async initFileLock ( ) : Promise < void > {
137
137
try {
138
- if ( fs . existsSync ( Utils . PathToFileLock ) ) {
139
- fs . rmdirSync ( Utils . PathToFileLock , { recursive : true } ) ;
140
- }
141
138
fs . mkdirSync ( Utils . PathToFileLock ) ;
139
+ } catch ( e ) { }
140
+
141
+ const pp = `${ Utils . PathToFileLock } /${ Config . getInstance ( ) . getServerPort ( ) } ` ;
142
+ try {
143
+ if ( fs . existsSync ( pp ) ) {
144
+ fs . rmdirSync ( pp , { recursive : true } ) ;
145
+ }
146
+ fs . mkdirSync ( pp ) ;
142
147
} catch ( e ) {
143
- console . log ( e ) ;
148
+ console . error ( e ) ;
144
149
}
145
150
}
146
151
You can’t perform that action at this time.
0 commit comments