Skip to content

Commit fb6b06d

Browse files
committed
perf: avoid snapshot journal serialization
1 parent 38dc7a2 commit fb6b06d

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandJournal.swift

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ struct RunnerCommandJournalEntry {
1414
var responseOk: Bool?
1515
var responseJson: String?
1616
var error: ErrorPayload?
17-
var updatedAtMs: Double
1817
}
1918

2019
final class RunnerCommandJournal {
@@ -34,8 +33,7 @@ final class RunnerCommandJournal {
3433
state: .accepted,
3534
responseOk: nil,
3635
responseJson: nil,
37-
error: nil,
38-
updatedAtMs: currentTimeMs()
36+
error: nil
3937
)
4038
order.removeAll { $0 == commandId }
4139
order.append(commandId)
@@ -104,14 +102,12 @@ final class RunnerCommandJournal {
104102
state: .accepted,
105103
responseOk: nil,
106104
responseJson: nil,
107-
error: nil,
108-
updatedAtMs: currentTimeMs()
105+
error: nil
109106
)
110107
entry.state = state
111108
entry.responseOk = responseOk
112109
entry.responseJson = responseJson
113110
entry.error = error
114-
entry.updatedAtMs = currentTimeMs()
115111
entries[commandId] = entry
116112
order.removeAll { $0 == commandId }
117113
order.append(commandId)
@@ -131,11 +127,8 @@ final class RunnerCommandJournal {
131127
return trimmed.isEmpty ? nil : trimmed
132128
}
133129

134-
private func currentTimeMs() -> Double {
135-
Date().timeIntervalSince1970 * 1000
136-
}
137-
138130
private func encodeResponseJson(_ response: Response) -> String? {
131+
guard response.data?.nodes == nil else { return nil }
139132
guard let data = try? JSONEncoder().encode(response) else { return nil }
140133
guard data.count <= maxResponseJsonBytes else { return nil }
141134
return String(data: data, encoding: .utf8)

0 commit comments

Comments
 (0)