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

Fix sandbox classic package upload #9633

Merged
merged 2 commits into from
May 12, 2021
Merged
Changes from 1 commit
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
Prev Previous commit
Refactor code
  • Loading branch information
rautenrieth-da committed May 11, 2021
commit f217e0c9d6b3198b4c688df4ca9b04baa71a0f48
Original file line number Diff line number Diff line change
Expand Up @@ -668,44 +668,42 @@ private class JdbcLedgerDao(
// This is again not an issue since all callers of this method always use the same value for all source descriptions.
val update = optEntry match {
case None =>
nmarton-da marked this conversation as resolved.
Show resolved Hide resolved
if (packages.nonEmpty) {
// Calling storePackageEntry() without providing a PackageLedgerEntry is used to copy initial packages,
// or in the case where the submission ID is unknown (package was submitted through a different participant).
Some(
Update.PublicPackageUpload(
archives = packages.view.map(_._1).toList,
sourceDescription = packages.head._2.sourceDescription,
recordTime = Time.Timestamp.assertFromInstant(packages.head._2.knownSince),
submissionId =
None, // If the submission ID is missing, this update will not insert a row in the package_entries table
)
)
} else {
None
}
// Calling storePackageEntry() without providing a PackageLedgerEntry is used to copy initial packages,
// or in the case where the submission ID is unknown (package was submitted through a different participant).
Update.PublicPackageUpload(
archives = packages.view.map(_._1).toList,
sourceDescription = packages.headOption.flatMap(
_._2.sourceDescription
),
recordTime = Time.Timestamp.assertFromInstant(
packages.headOption
.map(
_._2.knownSince
)
.getOrElse(Instant.EPOCH)
),
submissionId =
None, // If the submission ID is missing, this update will not insert a row in the package_entries table
)

case Some(PackageLedgerEntry.PackageUploadAccepted(submissionId, recordTime)) =>
Some(
Update.PublicPackageUpload(
archives = packages.view.map(_._1).toList,
sourceDescription = packages.headOption.flatMap(
_._2.sourceDescription
),
recordTime = Time.Timestamp.assertFromInstant(recordTime),
submissionId = Some(submissionId),
)
Update.PublicPackageUpload(
archives = packages.view.map(_._1).toList,
sourceDescription = packages.headOption.flatMap(
_._2.sourceDescription
),
recordTime = Time.Timestamp.assertFromInstant(recordTime),
submissionId = Some(submissionId),
)

case Some(PackageLedgerEntry.PackageUploadRejected(submissionId, recordTime, reason)) =>
Some(
Update.PublicPackageUploadRejected(
submissionId = submissionId,
recordTime = Time.Timestamp.assertFromInstant(recordTime),
rejectionReason = reason,
)
Update.PublicPackageUploadRejected(
submissionId = submissionId,
recordTime = Time.Timestamp.assertFromInstant(recordTime),
rejectionReason = reason,
)
}
sequentialIndexer.store(connection, offsetStep.offset, update)
sequentialIndexer.store(connection, offsetStep.offset, Some(update))
PersistenceResponse.Ok
}
}
Expand Down