Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
huangzhicong
/
SmartCanteen
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4b4b9d07
authored
Mar 13, 2020
by
pye52
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
现在指令执行完毕后不再有等待间隔了(避免部分指令执行完app退出而导致指令状态无法更新到数据库)
parent
feaf7256
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
11 deletions
+3
-11
app/src/main/java/com/bgycc/smartcanteen/viewModel/CommandViewModel.java
+3
-11
No files found.
app/src/main/java/com/bgycc/smartcanteen/viewModel/CommandViewModel.java
View file @
4b4b9d07
...
...
@@ -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
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment