From ba5dd7fc89495e58a22fdf006042fffe432e06d9 Mon Sep 17 00:00:00 2001 From: totetmatt Date: Fri, 22 Nov 2019 23:14:14 +0100 Subject: [PATCH] Change logic for enabling sample stream --- .../fr/totetmatt/mediamur/twitter/TwitterStream.scala | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/scala/fr/totetmatt/mediamur/twitter/TwitterStream.scala b/src/main/scala/fr/totetmatt/mediamur/twitter/TwitterStream.scala index 8c5d305..f1b7848 100644 --- a/src/main/scala/fr/totetmatt/mediamur/twitter/TwitterStream.scala +++ b/src/main/scala/fr/totetmatt/mediamur/twitter/TwitterStream.scala @@ -83,12 +83,11 @@ class TwitterStream(implicit materializer:ActorMaterializer) { if(isRunning) { stopStream() } - this.searchQuery = searchQuery - if(searchQuery.isEmpty) { - if(sampleStream) { - twitterStream.sample() - } + + if(sampleStream) { + twitterStream.sample() } else { + this.searchQuery = searchQuery twitterStream.filter(searchQuery:_*) } isRunning = true