[rustpotterks] Remove unnecessary thread sleep call (#14664)
* [rustpotterks] Remove unnecessary thread sleep call Signed-off-by: Miguel Álvarez <miguelwork92@gmail.com>
This commit is contained in:
parent
b9751dced3
commit
c30893281c
@ -191,12 +191,11 @@ public class RustpotterKSService implements KSService {
|
||||
while (!aborted.get()) {
|
||||
try {
|
||||
numBytesRead = audioStream.read(audioBuffer, bufferSize - remaining, remaining);
|
||||
if (aborted.get()) {
|
||||
if (aborted.get() || numBytesRead == -1) {
|
||||
break;
|
||||
}
|
||||
if (numBytesRead != remaining) {
|
||||
remaining = remaining - numBytesRead;
|
||||
Thread.sleep(100);
|
||||
continue;
|
||||
}
|
||||
remaining = bufferSize;
|
||||
@ -217,7 +216,7 @@ public class RustpotterKSService implements KSService {
|
||||
detection.delete();
|
||||
ksListener.ksEventReceived(new KSpottedEvent());
|
||||
}
|
||||
} catch (IOException | InterruptedException e) {
|
||||
} catch (IOException e) {
|
||||
String errorMessage = e.getMessage();
|
||||
ksListener.ksEventReceived(new KSErrorEvent(errorMessage != null ? errorMessage : "Unexpected error"));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user