Commit 4b4b9d07 by pye52

现在指令执行完毕后不再有等待间隔了(避免部分指令执行完app退出而导致指令状态无法更新到数据库)

parent feaf7256
......@@ -114,8 +114,6 @@ public class CommandViewModel extends ViewModel implements CommandProgressCallba
};
private class RequestRunnable implements Runnable {
// 每条指令执行间隔
private static final long EXEC_INTERVAL = 1500;
private Command command;
RequestRunnable(Command command) {
......@@ -173,15 +171,9 @@ public class CommandViewModel extends ViewModel implements CommandProgressCallba
// 将执行完毕的指令更新到数据库,此时会触发dataObserver的动作(会继续搜索下一条未执行完毕的指令)
private void commandFinishAndUpdateDB() {
try {
Thread.sleep(EXEC_INTERVAL);
} catch (InterruptedException e) {
LogUtils.w(TAG, e.getMessage(), e);
} finally {
command.finish();
LogUtils.d(TAG, "指令执行完毕: " + command.toString());
commandRepository.updateCommand(command);
}
command.finish();
LogUtils.d(TAG, "指令执行完毕: " + command.toString());
commandRepository.updateCommand(command);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment