~jan0sch/smederee
Showing details for patch 4303da0f408113a8f39a4cc5345c74f72f382984.
diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala 2025-05-06 11:06:25.458773260 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala 2025-05-06 11:06:25.458773260 +0000 @@ -713,8 +713,15 @@ case Some(repoId) => vcsMetadataRepo.findHealthCheck(repoId) case _ => Sync[F].pure(None) } - // TODO: Re-run the health check if the last patch date is newer than the check run date. - health <- cachedHealth match { + // Get the timestamp for the latest patch. + vcsLog <- darcs.log(directory.toNIO)(repositoryName.toString)(Chain("--last=1", "--xml-output")) + xmlLog <- Sync[F].delay(scala.xml.XML.loadString(vcsLog.stdout.toList.mkString)) + patches <- Sync[F].delay((xmlLog \ "patch").flatMap(VcsRepositoryPatchMetadata.fromDarcsXmlLog).toList) + latestPatch = patches.headOption.map(_.timestamp.toOffsetDateTime) + // Re-run the health check if the last patch date is newer than the check run date. + health <- cachedHealth.filter(healthCheck => + latestPatch.getOrElse(healthCheck.createdAt).compareTo(healthCheck.createdAt) <= 1 + ) match { case Some(healthCheck) => Sync[F].pure(healthCheck) case None => darcs