Skip to content

Commit 5d201d2

Browse files
committed
Properly commit metrics during each queued job
1 parent e603f0a commit 5d201d2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/MetricServiceProvider.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
namespace DirectoryTree\Metrics;
44

55
use Illuminate\Contracts\Foundation\Application;
6+
use Illuminate\Support\Facades\App;
7+
use Illuminate\Support\Facades\Queue;
68
use Illuminate\Support\ServiceProvider;
79

810
class MetricServiceProvider extends ServiceProvider
@@ -29,6 +31,10 @@ public function register(): void
2931
*/
3032
public function boot(): void
3133
{
34+
Queue::looping(function () {
35+
App::make(MetricManager::class)->commit();
36+
});
37+
3238
$publish = method_exists($this, 'publishesMigrations')
3339
? 'publishesMigrations'
3440
: 'publishes';

0 commit comments

Comments
 (0)