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(core): ensure needsReload flag works #5211

Merged
merged 2 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/server/instance-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export class GardenInstanceManager {

// Flag the instance for reloading when configs change
garden.events.once("configChanged", (_payload) => {
if (!garden.needsReload) {
if (!garden.needsReload()) {
Copy link
Member

Choose a reason for hiding this comment

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

Is there possibly a linter rule that catches these kinds of bugs? @TimBeyer @eysi09

garden.needsReload(true)
garden.log.info(
chalk.magenta.bold(
Expand Down
15 changes: 9 additions & 6 deletions core/src/server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -884,22 +884,25 @@ export class GardenServer extends EventEmitter {
})

let graph: ConfigGraph | undefined
let errors: GardenError[] = []
let error: GardenError | undefined

try {
graph = await garden.getConfigGraph({ log, emit: true })
loadConfigLog.success("Config loaded")
} catch (error) {
errors.push(toGardenError(error))
} catch (err) {
error = toGardenError(err)
} finally {
loadConfigLog.success(`Loading config failed with error: ${errors[0].message}`)
if (error) {
loadConfigLog.error(`Loading config failed with error: ${error.message}`)
} else {
loadConfigLog.success("Config loaded")
}
await cloudEventStream.close() // Note: This also flushes events
send(
"commandResult",
sanitizeValue({
requestId,
result: graph,
errors,
errors: [error],
})
)
}
Expand Down