Skip to content

Commit d241d12

Browse files
imsduSimon Dumas
andauthored
Fix logs for the schema validation job (#5157)
* Fix logs for the schema validation job --------- Co-authored-by: Simon Dumas <simon.dumas@epfl.ch>
1 parent 1531189 commit d241d12

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/schemas/job/SchemaValidationCoordinator.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ object SchemaValidationCoordinator {
1919
private val logger = Logger[SchemaValidationCoordinator]
2020

2121
def projectionMetadata(project: ProjectRef): ProjectionMetadata =
22-
ProjectionMetadata("schema", s"schema-$project-validate-resources", Some(project), None)
22+
ProjectionMetadata("schema", s"schema-validate-resources-$project", Some(project), None)
2323

2424
def apply(supervisor: Supervisor, schemaValidationStream: SchemaValidationStream): SchemaValidationCoordinator =
2525
new SchemaValidationCoordinator {

delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/schemas/job/SchemaValidationStream.scala

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,18 @@ object SchemaValidationStream {
4343
}
4444
} yield (Some(()))
4545

46-
private def log(message: String) = Stream.eval(logger.info(message))
47-
48-
override def apply(project: ProjectRef, offset: Offset): ElemStream[Unit] = {
49-
for {
50-
_ <- log(s"Starting validation of resources for project '$project'")
51-
stream <- resourceStream(project, offset).evalMap {
52-
_.evalMapFilter {
53-
case r if r.deprecated => IO.none
54-
case r if r.schema.iri == schemas.resources => IO.none
55-
case r => validateSingle(r)
56-
}
57-
}
58-
_ <- log(s"Validation of resources for project '$project' has been completed.")
59-
} yield stream
60-
61-
}
46+
override def apply(project: ProjectRef, offset: Offset): ElemStream[Unit] =
47+
Stream.eval(logger.info(s"Starting validation of resources for project '$project'")) >>
48+
resourceStream(project, offset)
49+
.evalMap {
50+
_.evalMapFilter {
51+
case r if r.deprecated => IO.none
52+
case r if r.schema.iri == schemas.resources => IO.none
53+
case r => validateSingle(r)
54+
}
55+
}
56+
.onFinalize {
57+
logger.info(s"Validation of resources for project '$project' has been completed.")
58+
}
6259
}
6360
}

0 commit comments

Comments
 (0)