Skip to content

Refactor/orchestrator/golden record task reserve - #1828

Draft
mohan06-mbrd wants to merge 21 commits into
eclipse-tractusx:mainfrom
mohan06-mbrd:refactor/orchestrator/golden-record-task-reserve
Draft

Refactor/orchestrator/golden record task reserve#1828
mohan06-mbrd wants to merge 21 commits into
eclipse-tractusx:mainfrom
mohan06-mbrd:refactor/orchestrator/golden-record-task-reserve

Conversation

@mohan06-mbrd

Copy link
Copy Markdown
Contributor

Description

Pre-review checks

Please ensure to do as many of the following checks as possible, before asking for committer review:

…I versions following pool pattern"

This reverts commit ffb36cd.
…BusinessPartnerRequest in request and parsed models
…nRecordTaskCreate with unified internal request models
# Conflicts:
#	bpdm-pool/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/service/parser/address/AddressSiteMembershipParser.kt
…skResolve with parser-operation architecture
…skReserve with parser-operation architecture

@nicoprow nicoprow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good to me. The logifentifiers methods that keep coming up in the services are good candidates for extraction though. Basically it is mapping logic for internal logging purposes. The code convention does not cover this case. I would propose creating a LogExtensions file in the Orchestrator util package (mapper package is also a valid candidate)

private fun calculateTaskPendingTimeout(task: GoldenRecordTaskDb): Instant =
task.createdAt.instant.plus(taskConfigProperties.taskPendingTimeout)

private fun Collection<GoldenRecordTaskDb>.toLogIdentifiers() =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point you duplicate the log identifier mapping function. Maybe extract it to a log extensions file in the mapper or util package to just draw from the same method. The method is quite small but I saw it several times already

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done Extracted toLogIdentifiers() to LogExtensions.kt in the util package. All operations can now reuse this shared logging extension.

@nicoprow nicoprow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some duplication errors otherwise looks fine

?.let { tasks -> logger.info { "Failed ${tasks.size} golden record tasks in step $step: ${toLogIdentifiers(tasks as Collection<GoldenRecordTaskDb>)}" } }
}

private fun toLogIdentifiers(tasks: Collection<GoldenRecordTaskDb>): String =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be moved to LogExtensions

}
}

private fun toUuidOrNull(uuidString: String): UUID? =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicated method in several services. Can be extracted to util package

}
}

private fun toUuidOrNull(uuidString: String): UUID? =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants