File tree Expand file tree Collapse file tree 6 files changed +34
-12
lines changed Expand file tree Collapse file tree 6 files changed +34
-12
lines changed Original file line number Diff line number Diff line change 7777
7878 'exclude ' => null ,
7979
80+ /*
81+ |--------------------------------------------------------------------------
82+ | Asynchronous settings
83+ |--------------------------------------------------------------------------
84+ |
85+ | Defines whether the operation will run synchronously or asynchronously.
86+ |
87+ | When this option is activated, each operation will be performed through jobs.
88+ */
89+
90+ 'async ' => false ,
91+
8092 /*
8193 |--------------------------------------------------------------------------
8294 | Queue
Original file line number Diff line number Diff line change @@ -236,19 +236,22 @@ return new class extends Operation
236236
237237In some cases, it becomes necessary to execute operations in an asynchronous manner without delaying the deployment process.
238238
239- To do this, you need to override the ` $ async` property in the operation class:
239+ To do this, you need to override the ` async ` method in the operation class:
240240
241241``` php
242242use DragonCode\LaravelDeployOperations\Operation;
243243
244244return new class extends Operation
245245{
246- protected bool $async = true;
247-
248246 public function __invoke(): void
249247 {
250248 // some code
251249 }
250+
251+ public function isAsync(): bool
252+ {
253+ return true;
254+ }
252255};
253256```
254257
Original file line number Diff line number Diff line change 1313
1414- [ Changed directory location] ( #changed-directory-location )
1515- [ Removed database transaction properties] ( #removed-database-transaction-properties )
16+ - [ Removed ` $async ` property] ( #removed-async-property )
1617
1718## Low-Impact Changes
1819
@@ -150,7 +151,10 @@ The following properties have been removed:
150151
151152Instead, you can use the previously available ` enabledTransactions ` and ` transactionAttempts ` methods.
152153
153- The default setting for these parameters has been moved to the ` transactions ` section of the configuration file.
154+ ## Removed ` $async ` property
155+
156+ The ` $async ` property has been removed from the base class.
157+ You can use the previously available ` isAsync ` method instead.
154158
155159## Stub name changed
156160
Original file line number Diff line number Diff line change @@ -30,9 +30,6 @@ abstract class Operation
3030 /** Defines a possible "pre-launch" of the operation. */
3131 protected bool $ before = true ;
3232
33- /** Defines whether the operation will run synchronously or asynchronously. */
34- protected bool $ async = false ;
35-
3633 public function getConnection (): ?string
3734 {
3835 return config ('deploy-operations.connection ' );
@@ -102,7 +99,7 @@ public function hasBefore(): bool
10299 */
103100 public function isAsync (): bool
104101 {
105- return $ this -> async ;
102+ return ( bool ) config ( ' deploy-operations. async' ) ;
106103 }
107104
108105 /**
Original file line number Diff line number Diff line change 88return new class extends Operation {
99 protected bool $ once = false ;
1010
11- protected bool $ async = true ;
12-
1311 public function __invoke (): void
1412 {
1513 $ this ->table ()->insert ([
@@ -21,4 +19,9 @@ protected function table(): Builder
2119 {
2220 return DB ::table ('every_time ' );
2321 }
22+
23+ public function isAsync (): bool
24+ {
25+ return true ;
26+ }
2427};
Original file line number Diff line number Diff line change 66use Ramsey \Uuid \Uuid ;
77
88return new class extends Operation {
9- protected bool $ async = true ;
10-
119 public function __invoke (): void
1210 {
1311 $ this ->table ()->insert ([
@@ -19,4 +17,9 @@ protected function table(): Builder
1917 {
2018 return DB ::table ('test ' );
2119 }
20+
21+ public function isAsync (): bool
22+ {
23+ return true ;
24+ }
2225};
You can’t perform that action at this time.
0 commit comments