Skip to content

Remove unused code #175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions src/Middleware/WithoutOverlappingMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

use Illuminate\Container\Container;
use Illuminate\Contracts\Cache\Repository as Cache;
use Illuminate\Queue\Events\JobProcessing;
use Illuminate\Support\Facades\Queue;
use Illuminate\Support\InteractsWithTime;
use Illuminate\Support\Str;

Expand All @@ -31,8 +29,6 @@ class WithoutOverlappingMiddleware

private $cache;

private $active = true;

public function __construct($workflowId, $type, $releaseAfter = 0, $expiresAfter = 0)
{
$this->key = "{$workflowId}";
Expand All @@ -47,10 +43,6 @@ public function handle($job, $next)
$locked = $this->lock($job);

if ($locked) {
Queue::before(
fn (JobProcessing $event) => $this->active = $job->job->getJobId() === $event->job->getJobId()
);
Queue::stopping(fn () => $this->active ? $this->unlock($job) : null);
try {
$next($job);
} finally {
Expand Down
13 changes: 0 additions & 13 deletions src/Middleware/WorkflowMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,17 @@

namespace Workflow\Middleware;

use Exception;
use Illuminate\Support\Facades\Queue;
use Illuminate\Support\Str;
use LimitIterator;
use SplFileObject;
use Workflow\Events\ActivityCompleted;
use Workflow\Events\ActivityFailed;
use Workflow\Events\ActivityStarted;
use Workflow\Serializers\Y;

final class WorkflowMiddleware
{
private $active = true;

public function handle($job, $next): void
{
Queue::stopping(fn () => $this->active ? $job->storedWorkflow->exceptions()
->create([
'class' => $job::class,
'exception' => Y::serialize(new Exception('Activity timed out.')),
]) : null);

$uuid = (string) Str::uuid();

ActivityStarted::dispatch(
Expand Down Expand Up @@ -71,8 +60,6 @@ public function handle($job, $next): void
]), now()
->format('Y-m-d\TH:i:s.u\Z'));
throw $throwable;
} finally {
$this->active = false;
}
}
}
2 changes: 1 addition & 1 deletion tests/Feature/TimeoutWorkflowTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ public function testTimeout(): void

while ($workflow->running());

$this->assertSame(2, $workflow->exceptions()->count());
$this->assertSame(1, $workflow->exceptions()->count());
}
}
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