Skip to content

Feature/ni 161 - Meteoalarm message post#75

Merged
teddmason merged 16 commits intodevelopmentfrom
feature/NI-161
Apr 2, 2026
Merged

Feature/ni 161 - Meteoalarm message post#75
teddmason merged 16 commits intodevelopmentfrom
feature/NI-161

Conversation

@teddmason
Copy link
Copy Markdown
Member

No description provided.

Comment thread lib/helpers/meteoalarm.js Outdated
Comment thread lib/helpers/meteoalarm.js Outdated
pwadmore-ea
pwadmore-ea previously approved these changes Feb 24, 2026
pwadmore-ea
pwadmore-ea previously approved these changes Feb 25, 2026
* Adding in additional logging, based from NI-161

* sonarcloud issues

* stripping out some logging, and fixing a twice declared var
@sonarqubecloud
Copy link
Copy Markdown

Comment thread lib/helpers/message.js
Comment on lines +17 to +34
console.log(`[getMessage] Cache HIT for ${key}`)
body = v2 ? cachedMessage.alert_v2 : cachedMessage.alert
console.log(`[getMessage] Message retrieved in ${Date.now() - fetchStart}ms for ${key}`)
return body
}

console.log(`[getMessage] Cache MISS for ${key}, fetching from database`)
const ret = await service.getMessage(key)
if (!ret?.rows || !Array.isArray(ret.rows) || ret.rows.length < 1 || !ret.rows[0].getmessage) {
console.log('[getMessage] No message found for ' + key)
throw new Error('No message found')
}
const message = ret.rows[0].getmessage
body = v2 ? message.alert_v2 : message.alert
// Cache the message in redis
await redis.set(key, message)
console.log(`[getMessage] Retrieved from database and cached: ${key}`)
console.log(`[getMessage] Message retrieved in ${Date.now() - fetchStart}ms for ${key}`)
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.

Should [getMessage] be replaced with [fetchMessageBody] so log entries reflect the correct function name? As fetchMessageBody is an internal function called from the getMessage function I'm happy with either approach and will approve the pull request.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The prefix was just meant to match the overarching lambda function that was invoked

@teddmason teddmason merged commit e2c97c8 into development Apr 2, 2026
2 of 3 checks passed
@teddmason teddmason deleted the feature/NI-161 branch April 2, 2026 07:40
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