@@ -255,14 +255,14 @@ final class Tests: XCTestCase {
255
255
let lifecycle = Lifecycle ( )
256
256
257
257
let item1 = NIOItem ( eventLoopGroup: eventLoopGroup)
258
- lifecycle. register ( name: " item1 " , start: . async ( item1. start) , shutdown: . async ( item1. shutdown) )
258
+ lifecycle. register ( name: " item1 " , start: . eventLoopFuture ( item1. start) , shutdown: . eventLoopFuture ( item1. shutdown) )
259
259
260
260
lifecycle. register ( name: " blocker " ,
261
261
start: { ( ) -> Void in try eventLoopGroup. next ( ) . makeSucceededFuture ( ( ) ) . wait ( ) } ,
262
262
shutdown: { ( ) -> Void in try eventLoopGroup. next ( ) . makeSucceededFuture ( ( ) ) . wait ( ) } )
263
263
264
264
let item2 = NIOItem ( eventLoopGroup: eventLoopGroup)
265
- lifecycle. register ( name: " item2 " , start: . async ( item2. start) , shutdown: . async ( item2. shutdown) )
265
+ lifecycle. register ( name: " item2 " , start: . eventLoopFuture ( item2. start) , shutdown: . eventLoopFuture ( item2. shutdown) )
266
266
267
267
lifecycle. start ( configuration: . init( shutdownSignal: nil ) ) { error in
268
268
XCTAssertNil ( error, " not expecting error " )
@@ -434,8 +434,8 @@ final class Tests: XCTestCase {
434
434
435
435
let item = NIOItem ( eventLoopGroup: eventLoopGroup)
436
436
lifecycle. register ( name: item. id,
437
- start: . async ( item. start) ,
438
- shutdown: . async ( item. shutdown) )
437
+ start: . eventLoopFuture ( item. start) ,
438
+ shutdown: . eventLoopFuture ( item. shutdown) )
439
439
440
440
lifecycle. start ( configuration: . init( shutdownSignal: nil ) ) { error in
441
441
XCTAssertNil ( error, " not expecting error " )
@@ -450,7 +450,7 @@ final class Tests: XCTestCase {
450
450
let lifecycle = Lifecycle ( )
451
451
452
452
let item = NIOItem ( eventLoopGroup: eventLoopGroup)
453
- lifecycle. registerShutdown ( name: item. id, . async ( item. shutdown) )
453
+ lifecycle. registerShutdown ( name: item. id, . eventLoopFuture ( item. shutdown) )
454
454
455
455
lifecycle. start ( configuration: . init( shutdownSignal: nil ) ) { error in
456
456
XCTAssertNil ( error, " not expecting error " )
@@ -466,11 +466,11 @@ final class Tests: XCTestCase {
466
466
467
467
let item = NIOItem ( eventLoopGroup: eventLoopGroup)
468
468
lifecycle. register ( name: item. id,
469
- start: . async {
469
+ start: . eventLoopFuture {
470
470
print ( " start " )
471
471
return item. start ( )
472
472
} ,
473
- shutdown: . async {
473
+ shutdown: . eventLoopFuture {
474
474
print ( " shutdown " )
475
475
return item. shutdown ( )
476
476
} )
@@ -488,7 +488,7 @@ final class Tests: XCTestCase {
488
488
let lifecycle = Lifecycle ( )
489
489
490
490
let item = NIOItem ( eventLoopGroup: eventLoopGroup)
491
- lifecycle. registerShutdown ( name: item. id, . async {
491
+ lifecycle. registerShutdown ( name: item. id, . eventLoopFuture {
492
492
print ( " shutdown " )
493
493
return item. shutdown ( )
494
494
} )
@@ -506,8 +506,8 @@ final class Tests: XCTestCase {
506
506
let lifecycle = Lifecycle ( )
507
507
508
508
lifecycle. register ( name: " test " ,
509
- start: . async { eventLoopGroup. next ( ) . makeFailedFuture ( TestError ( ) ) } ,
510
- shutdown: . async { eventLoopGroup. next ( ) . makeSucceededFuture ( ( ) ) } )
509
+ start: . eventLoopFuture { eventLoopGroup. next ( ) . makeFailedFuture ( TestError ( ) ) } ,
510
+ shutdown: . eventLoopFuture { eventLoopGroup. next ( ) . makeSucceededFuture ( ( ) ) } )
511
511
512
512
lifecycle. start ( configuration: . init( shutdownSignal: nil ) ) { error in
513
513
XCTAssert ( error is TestError , " expected error to match " )
@@ -546,12 +546,12 @@ final class Tests: XCTestCase {
546
546
let item = Item ( expectedData)
547
547
let lifecycle = Lifecycle ( )
548
548
lifecycle. register ( name: " test " ,
549
- start: . async {
549
+ start: . eventLoopFuture {
550
550
item. start ( ) . map { data -> Void in
551
551
state = . started( data)
552
552
}
553
553
} ,
554
- shutdown: . async {
554
+ shutdown: . eventLoopFuture {
555
555
item. shutdown ( ) . map { _ -> Void in
556
556
state = . shutdown
557
557
}
0 commit comments