From 0f74a9c4452a044ff619f0b24d69b41aece09b94 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 29 Sep 2022 17:17:42 -0700 Subject: Remove queueing parameter --- src/main/java/org/traccar/database/CommandsManager.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/main/java/org/traccar/database') diff --git a/src/main/java/org/traccar/database/CommandsManager.java b/src/main/java/org/traccar/database/CommandsManager.java index 2967b8abd..49eda79b2 100644 --- a/src/main/java/org/traccar/database/CommandsManager.java +++ b/src/main/java/org/traccar/database/CommandsManager.java @@ -18,8 +18,6 @@ package org.traccar.database; import org.traccar.BaseProtocol; import org.traccar.ServerManager; -import org.traccar.config.Config; -import org.traccar.config.Keys; import org.traccar.model.Command; import org.traccar.model.Device; import org.traccar.model.Position; @@ -55,22 +53,22 @@ public class CommandsManager { private final SmsManager smsManager; private final ConnectionManager connectionManager; - private final boolean queueing; - @Inject public CommandsManager( Storage storage, ServerManager serverManager, @Nullable SmsManager smsManager, - ConnectionManager connectionManager, Config config) { + ConnectionManager connectionManager) { this.storage = storage; this.serverManager = serverManager; this.smsManager = smsManager; this.connectionManager = connectionManager; - queueing = config.getBoolean(Keys.COMMANDS_QUEUEING); } public boolean sendCommand(Command command) throws Exception { long deviceId = command.getDeviceId(); if (command.getTextChannel()) { + if (smsManager == null) { + throw new RuntimeException("SMS not configured"); + } Device device = storage.getObject(Device.class, new Request( new Columns.Include("positionId", "phone"), new Condition.Equals("id", "id", deviceId))); Position position = storage.getObject(Position.class, new Request( @@ -92,8 +90,6 @@ public class CommandsManager { getDeviceQueue(deviceId).add(command); return false; } - } else if (!queueing) { - throw new RuntimeException("Device is not online"); } else { getDeviceQueue(deviceId).add(command); return false; -- cgit v1.2.3