Skip to content

Commit 7624fda

Browse files
Merge pull request #3821 from SwiftPackageIndex/swift-6.2
Update to swift-6.2 image
2 parents bce23ff + 778e9fe commit 7624fda

File tree

12 files changed

+46
-39
lines changed

12 files changed

+46
-39
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM registry.gitlab.com/finestructure/spi-base:1.2.2
1+
FROM registry.gitlab.com/finestructure/spi-base:1.3.0
22

33
# Install SPM build dependencies
44
RUN apt-get update && apt-get install -y curl git make unzip \

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
name: Test
3030
runs-on: ubuntu-latest
3131
container:
32-
image: registry.gitlab.com/finestructure/spi-base:1.2.2
32+
image: registry.gitlab.com/finestructure/spi-base:1.3.0
3333
options: --privileged
3434
steps:
3535
- name: GH Runner bug workaround
@@ -160,7 +160,7 @@ jobs:
160160
name: Release build
161161
runs-on: ubuntu-latest
162162
container:
163-
image: registry.gitlab.com/finestructure/spi-base:1.2.2
163+
image: registry.gitlab.com/finestructure/spi-base:1.3.0
164164
options: --privileged
165165
steps:
166166
- name: GH Runner bug workaround

.github/workflows/query-performance.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
runs-on: ubuntu-latest
2929
continue-on-error: true
3030
container:
31-
image: registry.gitlab.com/finestructure/spi-base:1.2.2
31+
image: registry.gitlab.com/finestructure/spi-base:1.3.0
3232
steps:
3333
- name: Checkout code
3434
uses: actions/checkout@v4

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# ================================
1919
# Build image
2020
# ================================
21-
FROM registry.gitlab.com/finestructure/spi-base:1.2.2 as build
21+
FROM registry.gitlab.com/finestructure/spi-base:1.3.0 as build
2222

2323
# Set up a build area
2424
WORKDIR /build
@@ -62,7 +62,7 @@ RUN [ -d /build/Resources ] && { mv /build/Resources ./Resources && chmod -R a-w
6262
# ================================
6363
# Run image
6464
# ================================
65-
FROM registry.gitlab.com/finestructure/spi-base:1.2.2
65+
FROM registry.gitlab.com/finestructure/spi-base:1.3.0
6666

6767
# NB sas 2022-09-23: We're not using a dedicated `vapor` user to run the executable, because it
6868
# makes managing the data in the checkouts volume difficult. See

LOCAL_DEVELOPMENT_SETUP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ The trickiest part of this is to ensure the test or app container can connect to
238238
So, in order to run the tests in a Linux container run:
239239

240240
```
241-
docker run --rm -v "$PWD":/host -w /host --add-host=host.docker.internal:host-gateway registry.gitlab.com/finestructure/spi-base:1.2.2 swift test
241+
docker run --rm -v "$PWD":/host -w /host --add-host=host.docker.internal:host-gateway registry.gitlab.com/finestructure/spi-base:1.3.0 swift test
242242
```
243243

244244
Make sure you use the most recent `spi-base` image. You can find the latest image name in the `test-docker` target, which also provides a convenient way to run all all tests in a docker container.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ test-docker:
8989
@# run tests inside a docker container
9090
docker run --rm -v "$(PWD)":/host -w /host \
9191
--add-host=host.docker.internal:host-gateway \
92-
registry.gitlab.com/finestructure/spi-base:1.2.2 \
92+
registry.gitlab.com/finestructure/spi-base:1.3.0 \
9393
make test
9494

9595
test-e2e: db-reset reconcile ingest analyze

Package.resolved

Lines changed: 3 additions & 3 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
@@ -34,7 +34,7 @@ let package = Package(
3434
.package(url: "https://github.com/SwiftPackageIndex/DependencyResolution.git", from: "1.1.2"),
3535
.package(url: "https://github.com/SwiftPackageIndex/SPIManifest.git", from: "1.9.0"),
3636
.package(url: "https://github.com/SwiftPackageIndex/SemanticVersion.git", from: "0.3.0"),
37-
.package(url: "https://github.com/SwiftPackageIndex/ShellOut.git", from: "3.1.4"),
37+
.package(url: "https://github.com/SwiftPackageIndex/ShellOut.git", from: "3.3.0"),
3838
.package(url: "https://github.com/finestructure/swift-package-manager.git", branch: "release/6.1"),
3939
.package(url: "https://github.com/pointfreeco/swift-custom-dump.git", from: "1.0.0"),
4040
.package(url: "https://github.com/pointfreeco/swift-dependencies", from: "1.8.0"),

Sources/App/Controllers/API/API+PackageCollectionController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ extension API {
6161
}
6262

6363

64-
extension PackageCollectionSigning.Model.SignedCollection: @retroactive @unchecked Sendable, Vapor.Content {}
64+
extension PackageCollectionSigning.Model.SignedCollection: @retroactive Vapor.Content {}
6565

6666

6767
extension API {

Sources/App/Core/Dependencies/RedisClient.swift

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ import NIOCore
1717
import Dependencies
1818
import DependenciesMacros
1919

20+
@globalActor
21+
actor RedisSingletonActor {
22+
static let shared = RedisSingletonActor()
23+
}
2024

2125
@DependencyClient
2226
struct RedisClient {
@@ -42,11 +46,11 @@ extension RedisClient: DependencyKey {
4246
static var liveValue: RedisClient {
4347
.init(
4448
set: { key, value, expiresIn in
45-
try await Redis.shared.set(key: key, value: value, expiresIn: expiresIn)
49+
try await Redis.shared().set(key: key, value: value, expiresIn: expiresIn)
4650
},
47-
get: { key in try await Redis.shared.get(key: key) },
48-
expire: { key, ttl in try await Redis.shared.expire(key: key, after: ttl) },
49-
increment: { key, value in try await Redis.shared.increment(key: key, by: value) }
51+
get: { key in try await Redis.shared().get(key: key) },
52+
expire: { key, ttl in try await Redis.shared().expire(key: key, after: ttl) },
53+
increment: { key, value in try await Redis.shared().increment(key: key, by: value) }
5054
)
5155
}
5256
}
@@ -79,30 +83,27 @@ extension RedisClient {
7983

8084
private actor Redis {
8185
var client: RediStack.RedisClient
82-
static private var task: Task<Redis, Swift.Error>?
86+
@RedisSingletonActor private static var _shared: Redis?
8387

84-
static var shared: Redis {
85-
get async throws {
86-
if let task {
87-
return try await task.value
88-
}
89-
let task = Task<Redis, Swift.Error> {
90-
var attemptsLeft = maxConnectionAttempts
91-
while attemptsLeft > 0 {
92-
do {
93-
return try await Redis()
94-
} catch {
95-
attemptsLeft -= 1
96-
@Dependency(\.logger) var logger
97-
logger.warning("Redis connection failed, \(attemptsLeft) attempts left. Error: \(error)")
98-
try? await Task.sleep(for: .milliseconds(500))
99-
}
100-
}
101-
throw Error.unavailable
88+
@RedisSingletonActor
89+
static func shared() async throws -> Redis {
90+
if let existing = _shared {
91+
return existing
92+
}
93+
var attemptsLeft = maxConnectionAttempts
94+
while attemptsLeft > 0 {
95+
do {
96+
let instance = try await Redis()
97+
_shared = instance
98+
return instance
99+
} catch {
100+
attemptsLeft -= 1
101+
@Dependency(\.logger) var logger
102+
logger.warning("Redis connection failed, \(attemptsLeft) attempts left. Error: \(error)")
103+
try? await Task.sleep(for: .milliseconds(500))
102104
}
103-
self.task = task
104-
return try await task.value
105105
}
106+
throw Error.unavailable
106107
}
107108

108109
enum Error: Swift.Error {

0 commit comments

Comments
 (0)