@@ -149,20 +149,20 @@ class ReAnalyzeVersionsTests: AppTestCase {
149
149
do {
150
150
let p = Package ( url: " 1 " )
151
151
try await p. save ( on: app. db)
152
- try createVersion ( app. db, p, updatedAt: . t0)
153
- try createVersion ( app. db, p, updatedAt: . t1)
152
+ try await createVersion ( app. db, p, updatedAt: . t0)
153
+ try await createVersion ( app. db, p, updatedAt: . t1)
154
154
}
155
155
do {
156
156
let p = Package ( url: " 2 " )
157
157
try await p. save ( on: app. db)
158
- try createVersion ( app. db, p, updatedAt: . t1)
159
- try createVersion ( app. db, p, updatedAt: . t3)
158
+ try await createVersion ( app. db, p, updatedAt: . t1)
159
+ try await createVersion ( app. db, p, updatedAt: . t3)
160
160
}
161
161
do {
162
162
let p = Package ( url: " 3 " )
163
163
try await p. save ( on: app. db)
164
- try createVersion ( app. db, p, updatedAt: . t3)
165
- try createVersion ( app. db, p, updatedAt: . t4)
164
+ try await createVersion ( app. db, p, updatedAt: . t3)
165
+ try await createVersion ( app. db, p, updatedAt: . t4)
166
166
}
167
167
168
168
// MUT
@@ -211,7 +211,7 @@ class ReAnalyzeVersionsTests: AppTestCase {
211
211
try await Analyze . analyze ( client: app. client,
212
212
database: app. db,
213
213
mode: . limit( 10 ) )
214
- try setAllVersionsUpdatedAt ( app. db, updatedAt: . t0)
214
+ try await setAllVersionsUpdatedAt ( app. db, updatedAt: . t0)
215
215
do {
216
216
let candidates = try await Package
217
217
. fetchReAnalysisCandidates ( app. db, before: cutoff, limit: 10 )
@@ -245,31 +245,29 @@ class ReAnalyzeVersionsTests: AppTestCase {
245
245
246
246
private func createVersion( _ db: Database ,
247
247
_ package : Package ,
248
- updatedAt: Date ) throws {
248
+ updatedAt: Date ) async throws {
249
249
let id = UUID ( )
250
- try Version ( id: id, package : package ) . save ( on: db) . wait ( )
251
- try setUpdatedAt ( db, versionId: id, updatedAt: updatedAt)
250
+ try await Version ( id: id, package : package ) . save ( on: db)
251
+ try await setUpdatedAt ( db, versionId: id, updatedAt: updatedAt)
252
252
}
253
253
254
254
255
255
private func setUpdatedAt( _ db: Database ,
256
256
versionId: Version . Id ,
257
- updatedAt: Date ) throws {
257
+ updatedAt: Date ) async throws {
258
258
let db = db as! SQLDatabase
259
- try db. raw ( """
259
+ try await db. raw ( """
260
260
update versions set updated_at = to_timestamp( \( bind: updatedAt. timeIntervalSince1970) )
261
261
where id = \( bind: versionId)
262
262
""" )
263
263
. run ( )
264
- . wait ( )
265
264
}
266
265
267
266
268
- private func setAllVersionsUpdatedAt( _ db: Database , updatedAt: Date ) throws {
267
+ private func setAllVersionsUpdatedAt( _ db: Database , updatedAt: Date ) async throws {
269
268
let db = db as! SQLDatabase
270
- try db. raw ( """
269
+ try await db. raw ( """
271
270
update versions set updated_at = to_timestamp( \( bind: updatedAt. timeIntervalSince1970) )
272
271
""" )
273
272
. run ( )
274
- . wait ( )
275
273
}
0 commit comments