diff --git a/config/segment.php b/config/segment.php index 2b48de1..a485a0f 100644 --- a/config/segment.php +++ b/config/segment.php @@ -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, ]; diff --git a/src/SegmentServiceProvider.php b/src/SegmentServiceProvider.php index f3ddc7b..4692789 100644 --- a/src/SegmentServiceProvider.php +++ b/src/SegmentServiceProvider.php @@ -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(); + }); + } } /**