Skip to content

Commit

Permalink
Merge pull request #165 from FlowFuse/fix-team-broker-placeholder
Browse files Browse the repository at this point in the history
Skip the team broker when checking to restart agents
  • Loading branch information
knolleary authored Feb 7, 2025
2 parents e5a2971 + c6b17d2 commit c21617b
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions localfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ async function getMQTTAgentList (driver) {
})

agents.forEach(async (agent) => {
if (agent.settings.port) {
if (agent.Team && agent.settings.port) {
driver._usedAgentPorts.add(agent.settings.port)
}
})
Expand Down Expand Up @@ -285,19 +285,21 @@ async function checkExistingMQTTAgents (driver) {
const brokers = await getMQTTAgentList(driver)

brokers.forEach(async (broker) => {
if (broker.state !== 'running') {
return
}
if (broker.Team) {
if (broker.state !== 'running') {
return
}

try {
await got.get(`http://localhost:${broker.settings.port}/healthz`, {
timeout: {
request: 1000
}
}).json()
} catch (err) {
logger.info(`Starting MQTT Agent ${broker.hashid} on port ${broker.settings.port}`)
launchMQTTAgent(broker, driver)
try {
await got.get(`http://localhost:${broker.settings.port}/healthz`, {
timeout: {
request: 1000
}
}).json()
} catch (err) {
logger.info(`Starting MQTT Agent ${broker.hashid} on port ${broker.settings.port}`)
launchMQTTAgent(broker, driver)
}
}
})
}
Expand Down

0 comments on commit c21617b

Please sign in to comment.