Skip to content

Commit 55e26ab

Browse files
authored
Remove unused code (laravel-workflow#175)
1 parent 5ab3a79 commit 55e26ab

File tree

3 files changed

+1
-22
lines changed

3 files changed

+1
-22
lines changed

src/Middleware/WithoutOverlappingMiddleware.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
use Illuminate\Container\Container;
88
use Illuminate\Contracts\Cache\Repository as Cache;
9-
use Illuminate\Queue\Events\JobProcessing;
10-
use Illuminate\Support\Facades\Queue;
119
use Illuminate\Support\InteractsWithTime;
1210
use Illuminate\Support\Str;
1311

@@ -31,8 +29,6 @@ class WithoutOverlappingMiddleware
3129

3230
private $cache;
3331

34-
private $active = true;
35-
3632
public function __construct($workflowId, $type, $releaseAfter = 0, $expiresAfter = 0)
3733
{
3834
$this->key = "{$workflowId}";
@@ -47,10 +43,6 @@ public function handle($job, $next)
4743
$locked = $this->lock($job);
4844

4945
if ($locked) {
50-
Queue::before(
51-
fn (JobProcessing $event) => $this->active = $job->job->getJobId() === $event->job->getJobId()
52-
);
53-
Queue::stopping(fn () => $this->active ? $this->unlock($job) : null);
5446
try {
5547
$next($job);
5648
} finally {

src/Middleware/WorkflowMiddleware.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,17 @@
44

55
namespace Workflow\Middleware;
66

7-
use Exception;
8-
use Illuminate\Support\Facades\Queue;
97
use Illuminate\Support\Str;
108
use LimitIterator;
119
use SplFileObject;
1210
use Workflow\Events\ActivityCompleted;
1311
use Workflow\Events\ActivityFailed;
1412
use Workflow\Events\ActivityStarted;
15-
use Workflow\Serializers\Y;
1613

1714
final class WorkflowMiddleware
1815
{
19-
private $active = true;
20-
2116
public function handle($job, $next): void
2217
{
23-
Queue::stopping(fn () => $this->active ? $job->storedWorkflow->exceptions()
24-
->create([
25-
'class' => $job::class,
26-
'exception' => Y::serialize(new Exception('Activity timed out.')),
27-
]) : null);
28-
2918
$uuid = (string) Str::uuid();
3019

3120
ActivityStarted::dispatch(
@@ -71,8 +60,6 @@ public function handle($job, $next): void
7160
]), now()
7261
->format('Y-m-d\TH:i:s.u\Z'));
7362
throw $throwable;
74-
} finally {
75-
$this->active = false;
7663
}
7764
}
7865
}

tests/Feature/TimeoutWorkflowTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ public function testTimeout(): void
1818

1919
while ($workflow->running());
2020

21-
$this->assertSame(2, $workflow->exceptions()->count());
21+
$this->assertSame(1, $workflow->exceptions()->count());
2222
}
2323
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy