Skip to content
This repository has been archived by the owner on Apr 13, 2022. It is now read-only.

Commit

Permalink
Merge pull request #11 from AltThree/queue-flush
Browse files Browse the repository at this point in the history
Flush segment on each queue loop
  • Loading branch information
GrahamCampbell authored Mar 3, 2018
2 parents c9f60ba + 96ec3e8 commit ed0d71c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/SegmentServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public function boot()
if ($writeKey = $this->app->config->get('segment.write_key')) {
Segment::init($writeKey, (array) $this->app->config->get('segment.init_options'));
}

$this->setupQueue();
}

/**
Expand All @@ -57,6 +59,18 @@ protected function setupConfig()
$this->mergeConfigFrom($source, 'segment');
}

/**
* Setup the queue.
*
* @return void
*/
protected function setupQueue()
{
$this->app->queue->looping(function () {
Segment::flush();
});
}

/**
* Register the service provider.
*
Expand Down

0 comments on commit ed0d71c

Please sign in to comment.