@@ -59,27 +59,27 @@ public function acquire()
5959
6060 try {
6161 $ this ->connection ->table ($ this ->table )->insert ([
62- 'id ' => $ this ->name ,
62+ 'key ' => $ this ->name ,
6363 'owner ' => $ this ->owner ,
64- 'expires_at ' => $ this ->expiresAt (),
64+ 'expiration ' => $ this ->expiresAt (),
6565 ]);
6666
6767 $ acquired = true ;
6868 } catch (QueryException $ e ) {
6969 $ updated = $ this ->connection ->table ($ this ->table )
70- ->where ('id ' , $ this ->name )
70+ ->where ('key ' , $ this ->name )
7171 ->where (function ($ query ) {
72- return $ query ->where ('owner ' , $ this ->owner )->orWhere ('expires_at ' , '<= ' , time ());
72+ return $ query ->where ('owner ' , $ this ->owner )->orWhere ('expiration ' , '<= ' , time ());
7373 })->update ([
7474 'owner ' => $ this ->owner ,
75- 'expires_at ' => $ this ->expiresAt (),
75+ 'expiration ' => $ this ->expiresAt (),
7676 ]);
7777
7878 $ acquired = $ updated >= 1 ;
7979 }
8080
8181 if (random_int (1 , $ this ->lottery [1 ]) <= $ this ->lottery [0 ]) {
82- $ this ->connection ->table ($ this ->table )->where ('expires_at ' , '<= ' , time ())->delete ();
82+ $ this ->connection ->table ($ this ->table )->where ('expiration ' , '<= ' , time ())->delete ();
8383 }
8484
8585 return $ acquired ;
@@ -104,7 +104,7 @@ public function release()
104104 {
105105 if ($ this ->isOwnedByCurrentProcess ()) {
106106 $ this ->connection ->table ($ this ->table )
107- ->where ('id ' , $ this ->name )
107+ ->where ('key ' , $ this ->name )
108108 ->where ('owner ' , $ this ->owner )
109109 ->delete ();
110110
@@ -122,7 +122,7 @@ public function release()
122122 public function forceRelease ()
123123 {
124124 $ this ->connection ->table ($ this ->table )
125- ->where ('id ' , $ this ->name )
125+ ->where ('key ' , $ this ->name )
126126 ->delete ();
127127 }
128128
@@ -133,6 +133,6 @@ public function forceRelease()
133133 */
134134 protected function getCurrentOwner ()
135135 {
136- return optional ($ this ->connection ->table ($ this ->table )->where ('id ' , $ this ->name )->first ())->owner ;
136+ return optional ($ this ->connection ->table ($ this ->table )->where ('key ' , $ this ->name )->first ())->owner ;
137137 }
138138}
0 commit comments