Skip to content

Commit 380fe33

Browse files
makonigevartosky
andauthored
1.5.0 (#18)
* swift-docc-plugin 1.3.0 * async-http-client 1.19.0 * replaced deprecated .createNew with the new .singleton * Adding _find capability. (#13) * docs * tabs * renames * added test for find method with body * docs added * findError added * tests renamed * added test for find method with generic type * docs * README updated * updated dependencies * docs updated * try Swift 5.7.1 * Update build-ubuntu.yml * Swift 5.7.3 * Revert "Swift 5.7.3" This reverts commit ab8f67a. * updated dependencies * Docs updated * Delete .github/workflows/CodeQL.yml * dependencies updated * fixed when update method didn’t use passed dateEncodingStrategy * noData error added * migrating to new HTTPClientRequest from HTTPClient.Request wip * migrating to new HTTPClientRequest from HTTPClient.Request wip * migrating to new HTTPClientRequest from HTTPClient.Request wip * migrating to new HTTPClientRequest from HTTPClient.Request wip * migrating to new HTTPClientRequest from HTTPClient.Request wip * migrating to new HTTPClientRequest from HTTPClient.Request wip * … * migrating to new HTTPClientRequest from HTTPClient.Request wip * rename * tests updated * auth fixed * collect body bytes before returning response * param renamed to make keep backward compatibility with old methods * marking old find as deprecated * private * deprecated message * renames * moved deprecations * docs * docs * added Codable to CouchDBRepresentable protocol * added RowsResponse model * docs * Vapor tutorial updated * docs * docs and refactoring * docs and refactoring * Tutorials updated * docs * platforms list updated * minimum swift version 5.8 * workflow updated * Update build-ubuntu.yml * Update build-macos.yml * import NIOFoundationCompat to fix building on Ubuntu * using async-http-client from 1.21.0. Not calling http * Using HTTPClient.shared if eventLoopGroup not provided. No more calls httpClient.syncShutdown() if using shared singleton --------- Co-authored-by: Gregório Gevartosky Torrezan <[email protected]>
1 parent 46f38da commit 380fe33

File tree

4 files changed

+63
-39
lines changed

4 files changed

+63
-39
lines changed

Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ let package = Package(
1111
.library(name: "CouchDBClient", targets: ["CouchDBClient"]),
1212
],
1313
dependencies: [
14-
.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.0.0"),
14+
.package(url: "https://github.com/swift-server/async-http-client", from: "1.21.0"),
1515
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.3.0")
1616
],
1717
targets: [

Sources/CouchDBClient/CouchDB+Deprecated.swift

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,14 @@ extension CouchDBClient {
6464
if let eventLoopGroup = eventLoopGroup {
6565
httpClient = HTTPClient(eventLoopGroupProvider: .shared(eventLoopGroup))
6666
} else {
67-
httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
67+
httpClient = HTTPClient.shared
6868
}
6969

7070
defer {
71-
DispatchQueue.main.async {
72-
try? httpClient.syncShutdown()
71+
if eventLoopGroup != nil {
72+
DispatchQueue.main.async {
73+
try? httpClient.syncShutdown()
74+
}
7375
}
7476
}
7577

@@ -110,12 +112,14 @@ extension CouchDBClient {
110112
if let eventLoopGroup = eventLoopGroup {
111113
httpClient = HTTPClient(eventLoopGroupProvider: .shared(eventLoopGroup))
112114
} else {
113-
httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
115+
httpClient = HTTPClient.shared
114116
}
115117

116118
defer {
117-
DispatchQueue.main.async {
118-
try? httpClient.syncShutdown()
119+
if eventLoopGroup != nil {
120+
DispatchQueue.main.async {
121+
try? httpClient.syncShutdown()
122+
}
119123
}
120124
}
121125

Sources/CouchDBClient/CouchDBClient.swift

Lines changed: 50 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,14 @@ public class CouchDBClient {
166166
if let eventLoopGroup = eventLoopGroup {
167167
httpClient = HTTPClient(eventLoopGroupProvider: .shared(eventLoopGroup))
168168
} else {
169-
httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
169+
httpClient = HTTPClient.shared
170170
}
171171

172172
defer {
173-
DispatchQueue.main.async {
174-
try? httpClient.syncShutdown()
173+
if eventLoopGroup != nil {
174+
DispatchQueue.main.async {
175+
try? httpClient.syncShutdown()
176+
}
175177
}
176178
}
177179

@@ -214,12 +216,14 @@ public class CouchDBClient {
214216
if let eventLoopGroup = eventLoopGroup {
215217
httpClient = HTTPClient(eventLoopGroupProvider: .shared(eventLoopGroup))
216218
} else {
217-
httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
219+
httpClient = HTTPClient.shared
218220
}
219221

220222
defer {
221-
DispatchQueue.main.async {
222-
try? httpClient.syncShutdown()
223+
if eventLoopGroup != nil {
224+
DispatchQueue.main.async {
225+
try? httpClient.syncShutdown()
226+
}
223227
}
224228
}
225229

@@ -253,12 +257,14 @@ public class CouchDBClient {
253257
if let eventLoopGroup = eventLoopGroup {
254258
httpClient = HTTPClient(eventLoopGroupProvider: .shared(eventLoopGroup))
255259
} else {
256-
httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
260+
httpClient = HTTPClient.shared
257261
}
258262

259263
defer {
260-
DispatchQueue.main.async {
261-
try? httpClient.syncShutdown()
264+
if eventLoopGroup != nil {
265+
DispatchQueue.main.async {
266+
try? httpClient.syncShutdown()
267+
}
262268
}
263269
}
264270

@@ -312,12 +318,14 @@ public class CouchDBClient {
312318
if let eventLoopGroup = eventLoopGroup {
313319
httpClient = HTTPClient(eventLoopGroupProvider: .shared(eventLoopGroup))
314320
} else {
315-
httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
321+
httpClient = HTTPClient.shared
316322
}
317323

318324
defer {
319-
DispatchQueue.main.async {
320-
try? httpClient.syncShutdown()
325+
if eventLoopGroup != nil {
326+
DispatchQueue.main.async {
327+
try? httpClient.syncShutdown()
328+
}
321329
}
322330
}
323331

@@ -426,12 +434,14 @@ public class CouchDBClient {
426434
if let eventLoopGroup = eventLoopGroup {
427435
httpClient = HTTPClient(eventLoopGroupProvider: .shared(eventLoopGroup))
428436
} else {
429-
httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
437+
httpClient = HTTPClient.shared
430438
}
431439

432440
defer {
433-
DispatchQueue.main.async {
434-
try? httpClient.syncShutdown()
441+
if eventLoopGroup != nil {
442+
DispatchQueue.main.async {
443+
try? httpClient.syncShutdown()
444+
}
435445
}
436446
}
437447

@@ -580,12 +590,14 @@ public class CouchDBClient {
580590
if let eventLoopGroup = eventLoopGroup {
581591
httpClient = HTTPClient(eventLoopGroupProvider: .shared(eventLoopGroup))
582592
} else {
583-
httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
593+
httpClient = HTTPClient.shared
584594
}
585595

586596
defer {
587-
DispatchQueue.main.async {
588-
try? httpClient.syncShutdown()
597+
if eventLoopGroup != nil {
598+
DispatchQueue.main.async {
599+
try? httpClient.syncShutdown()
600+
}
589601
}
590602
}
591603

@@ -661,12 +673,14 @@ public class CouchDBClient {
661673
if let eventLoopGroup = eventLoopGroup {
662674
httpClient = HTTPClient(eventLoopGroupProvider: .shared(eventLoopGroup))
663675
} else {
664-
httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
676+
httpClient = HTTPClient.shared
665677
}
666678

667679
defer {
668-
DispatchQueue.main.async {
669-
try? httpClient.syncShutdown()
680+
if eventLoopGroup != nil {
681+
DispatchQueue.main.async {
682+
try? httpClient.syncShutdown()
683+
}
670684
}
671685
}
672686

@@ -803,12 +817,14 @@ public class CouchDBClient {
803817
if let eventLoopGroup = eventLoopGroup {
804818
httpClient = HTTPClient(eventLoopGroupProvider: .shared(eventLoopGroup))
805819
} else {
806-
httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
820+
httpClient = HTTPClient.shared
807821
}
808822

809823
defer {
810-
DispatchQueue.main.async {
811-
try? httpClient.syncShutdown()
824+
if eventLoopGroup != nil {
825+
DispatchQueue.main.async {
826+
try? httpClient.syncShutdown()
827+
}
812828
}
813829
}
814830

@@ -915,12 +931,14 @@ public class CouchDBClient {
915931
if let eventLoopGroup = eventLoopGroup {
916932
httpClient = HTTPClient(eventLoopGroupProvider: .shared(eventLoopGroup))
917933
} else {
918-
httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
934+
httpClient = HTTPClient.shared
919935
}
920936

921937
defer {
922-
DispatchQueue.main.async {
923-
try? httpClient.syncShutdown()
938+
if eventLoopGroup != nil {
939+
DispatchQueue.main.async {
940+
try? httpClient.syncShutdown()
941+
}
924942
}
925943
}
926944

@@ -1006,12 +1024,14 @@ internal extension CouchDBClient {
10061024
if let eventLoopGroup = eventLoopGroup {
10071025
httpClient = HTTPClient(eventLoopGroupProvider: .shared(eventLoopGroup))
10081026
} else {
1009-
httpClient = HTTPClient(eventLoopGroupProvider: .singleton)
1027+
httpClient = HTTPClient.shared
10101028
}
10111029

10121030
defer {
1013-
DispatchQueue.main.async {
1014-
try? httpClient.syncShutdown()
1031+
if eventLoopGroup != nil {
1032+
DispatchQueue.main.async {
1033+
try? httpClient.syncShutdown()
1034+
}
10151035
}
10161036
}
10171037

0 commit comments

Comments
 (0)