Skip to content

Commit 2f8794b

Browse files
committed
store SHA-1 hashes for *all* semver tags, since we are no longer using that as a proxy for symbol graph state
1 parent d90e146 commit 2f8794b

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

Sources/UnidocDB/Packages/PackageDatabase.Editions.swift

+3-17
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,10 @@ extension PackageDatabase.Editions
111111
version:SemanticVersion,
112112
with session:Mongo.Session) async throws -> Int32?
113113
{
114-
// We use the SHA-1 hash as “proof” that the edition has at least one symbol graph.
115-
// Therefore, merely registering tags does not update hashes.
116114
let placement:Placement = try await self.register(package: package,
117115
version: version,
118116
refname: tag.name,
119-
sha1: nil,
117+
sha1: tag.hash,
120118
with: session)
121119

122120
return placement.new ? placement.coordinate : nil
@@ -152,24 +150,12 @@ extension PackageDatabase.Editions
152150
{
153151
switch placement.sha1
154152
{
155-
case nil:
156-
// If the edition would gain a hash, we should update it.
157-
158-
// FIXME: this can race another update, in which case we will store an
159-
// arbitrary choice of hash without marking the edition dirty.
160-
// We should use `placement.sha1` as a hint to skip the update only,
161-
// and set the dirty flag within a custom update statement.
162-
try await self.update(some: edition, with: session)
163-
164153
case sha1?:
165154
// Nothing to do.
166155
break
167156

168-
case _?:
169-
try await self.update(field: PackageEdition[.lost],
170-
of: edition.id,
171-
to: true,
172-
with: session)
157+
case _:
158+
try await self.update(some: edition, with: session)
173159
}
174160
}
175161

0 commit comments

Comments
 (0)