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(server): fix instance task error #988

Merged
merged 1 commit into from
Mar 30, 2023

Conversation

maslow
Copy link
Member

@maslow maslow commented Mar 30, 2023

No description provided.

@@ -130,7 +130,7 @@ export class InstanceTaskService {
const instance = await this.instanceService.get(app)
const available = isConditionTrue(
'Available',
instance.deployment.status?.conditions,
instance.deployment?.status?.conditions || [],
)
if (!available) {
await this.relock(appid, waitingTime)
Copy link

Choose a reason for hiding this comment

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

:

The code patch looks good, and it appears the intent is to check if the deployment status condition is true. It looks like the code is trying to access the instance object and check the deployment status condition.

However, there is a bug risk because the instance object might be null. To prevent this, the code should add a check for null before attempting to access the instance object. Additionally, the code should check if the instance.deployment object is also not null before accessing the status conditions.

The code patch can be improved by adding more defensive programming. For example, the code can check for any edge cases that could lead to an error and handle those cases gracefully. The code should also include more comments to explain what it is doing and why.

@maslow maslow merged commit 63cc523 into labring:main Mar 30, 2023
@maslow maslow deleted the fix-instance-task-error branch March 30, 2023 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant