Skip to content

Commit

Permalink
Added support for flush control inside the config
Browse files Browse the repository at this point in the history
  • Loading branch information
markosorec committed Mar 18, 2019
1 parent a679765 commit fc5d883
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
15 changes: 15 additions & 0 deletions config/segment.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,19 @@
*/

'init_options' => [],

/*
|--------------------------------------------------------------------------
| Segment Flush Options
|--------------------------------------------------------------------------
|
| This option toggles Segment flush, which will forcibly flush data to Segment servers.
|
| See: https://segment.com/docs/sources/server/php/#flush.
|
| Default: 0
|
*/

'flush' => 1,
];
8 changes: 5 additions & 3 deletions src/SegmentServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ protected function setupConfig()
*/
protected function setupQueue()
{
$this->app->queue->looping(function () {
Segment::flush();
});
if(config('segment.flush') === 1) {
$this->app->queue->looping(function () {
Segment::flush();
});
}
}

/**
Expand Down

0 comments on commit fc5d883

Please sign in to comment.