Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions agent/lib/src/adb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,13 @@ class Adb {
return results;
}

/// Kills and restarts the `adb` server.
/// Kills the `adb` server causing it to start a new instance upon next
/// command.
///
/// Restarting `adb` helps with keeping device connections alive. When `adb`
/// runs non-stop for too long it loses connections to devices.
static Future restart() async {
int exitCode = await exec(config.adbPath, ['kill-server'], canFail: false);

if (exitCode != 0)
throw 'Failed to kill ADB server';

exitCode = await exec(config.adbPath, ['start-server'], canFail: false);

if (exitCode != 0)
throw 'Failed to start ADB server';
await exec(config.adbPath, ['kill-server'], canFail: false);
}

static Future<List<String>> get deviceIds async {
Expand Down
2 changes: 1 addition & 1 deletion db/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ type Task struct {

// MaxAttempts is the maximum number of times a single task will be attempted
// before giving up on it.
const MaxAttempts = 3
const MaxAttempts = 2

// TaskStatus indicates the status of a task.
type TaskStatus string
Expand Down