Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase Stream Payload Delay #31

Merged
merged 3 commits into from
Aug 18, 2023
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
name: macOS
runs-on: firebreak
env:
DEVELOPER_DIR: /Applications/Xcode_14.3.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_14.3.1.app/Contents/Developer
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
Expand All @@ -35,7 +35,7 @@ jobs:
name: Linux
runs-on: ubuntu-22.04
container:
image: swiftlang/swift:nightly-5.8-jammy
image: swift:5.8.1-jammy
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
name: Upload Release Artifact
runs-on: firebreak
env:
DEVELOPER_DIR: /Applications/Xcode_14.3.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_14.3.1.app/Contents/Developer
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
32 changes: 16 additions & 16 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/vapor/async-kit.git",
"state" : {
"revision" : "a61da00d404ec91d12766f1b9aac7d90777b484d",
"version" : "1.17.0"
"revision" : "eab9edff78e8ace20bd7cb6e792ab46d54f59ab9",
"version" : "1.18.0"
}
},
{
Expand All @@ -41,8 +41,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/vapor/routing-kit.git",
"state" : {
"revision" : "611bc45c5dfb1f54b84d99b89d1f72191fb6b71b",
"version" : "4.7.2"
"revision" : "e0539da5b60a60d7381f44cdcf04036f456cee2f",
"version" : "4.8.0"
}
},
{
Expand Down Expand Up @@ -86,17 +86,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-crypto.git",
"state" : {
"revision" : "33a20e650c33f6d72d822d558333f2085effa3dc",
"version" : "2.5.0"
"revision" : "60f13f60c4d093691934dc6cfdf5f508ada1f894",
"version" : "2.6.0"
}
},
{
"identity" : "swift-log",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-log.git",
"state" : {
"revision" : "32e8d724467f8fe623624570367e3d50c5638e46",
"version" : "1.5.2"
"revision" : "532d8b529501fb73a2455b179e0bbb6d49b652ed",
"version" : "1.5.3"
}
},
{
Expand All @@ -113,8 +113,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio.git",
"state" : {
"revision" : "a2e487b77f17edbce9a65f2b7415f2f479dc8e48",
"version" : "2.57.0"
"revision" : "cf281631ff10ec6111f2761052aa81896a83a007",
"version" : "2.58.0"
}
},
{
Expand All @@ -140,17 +140,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-ssl.git",
"state" : {
"revision" : "e866a626e105042a6a72a870c88b4c531ba05f83",
"version" : "2.24.0"
"revision" : "320bd978cceb8e88c125dcbb774943a92f6286e9",
"version" : "2.25.0"
}
},
{
"identity" : "swift-nio-transport-services",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-transport-services.git",
"state" : {
"revision" : "41f4098903878418537020075a4d8a6e20a0b182",
"version" : "1.17.0"
"revision" : "e7403c35ca6bb539a7ca353b91cc2d8ec0362d58",
"version" : "1.19.0"
}
},
{
Expand All @@ -167,8 +167,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/vapor/vapor.git",
"state" : {
"revision" : "6b96684e150d3b3afcd53df12fe66e6bd9b67a04",
"version" : "4.78.0"
"revision" : "1bb4a2ed94bec7a92f92e82896408c785d068f5c",
"version" : "4.79.0"
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions Sources/Data.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func createDataRoutes(for app: Application) throws {

let response = Response(body: .init(stream: { writer in
var bytesToSend = count
request.eventLoop.scheduleRepeatedTask(initialDelay: .seconds(0), delay: .milliseconds(1)) { task in
request.eventLoop.scheduleRepeatedTask(initialDelay: .seconds(0), delay: .milliseconds(20)) { task in
guard bytesToSend > 0 else { task.cancel(); _ = writer.write(.end); return }

_ = writer.write(.buffer(.init(integer: UInt8(bytesToSend))))
Expand All @@ -104,7 +104,7 @@ func createDataRoutes(for app: Application) throws {
let encodedReply = try encoder.encodeAsByteBuffer(reply, allocator: app.allocator)
let response = Response(body: .init(stream: { writer in
var payloadsToSend = count
request.eventLoop.scheduleRepeatedTask(initialDelay: .seconds(0), delay: .milliseconds(1)) { task in
request.eventLoop.scheduleRepeatedTask(initialDelay: .seconds(0), delay: .milliseconds(20)) { task in
guard payloadsToSend > 0 else { task.cancel(); _ = writer.write(.end); return }

_ = writer.write(.buffer(encodedReply))
Expand Down