Skip to content

Comments

feat(services): Add retry logic and timeout to external API calls#374

Merged
mhieta merged 1 commit intomainfrom
seer/feat/pk-get-retry-timeout
Jan 27, 2026
Merged

feat(services): Add retry logic and timeout to external API calls#374
mhieta merged 1 commit intomainfrom
seer/feat/pk-get-retry-timeout

Conversation

@sentry
Copy link
Contributor

@sentry sentry bot commented Jan 27, 2026

Description

  • Implemented retry logic with a maximum of 3 attempts and a exponential backoff retry delay for the pk_get utility function.
  • Set the request timeout for external API calls to 55 seconds to prevent issues with proxy timeouts.
  • Replaced print statements with logging for API call information and retry attempts.
  • Added comprehensive unit tests for the pk_get function, covering success, parameters, HTTP errors, and various retry scenarios.

Context

Fixes PALVELUKARTTA-API-36. The issue was that: pk_get's non-streaming requests.get call to www.hel.fi's ontologytree endpoint exceeds 300-second read timeout due to large payload.

This fix was generated by Seer in Sentry, triggered by mika.hietanen@anders.com. 👁️ Run ID: 631212

Not quite right? Click here to continue debugging with Seer.

PALVELUKARTTA-API-36

How Has This Been Tested?

Comprehensive unit tests were added for the pk_get function, covering success, parameters, HTTP errors, and various retry scenarios.

@mhieta mhieta force-pushed the seer/feat/pk-get-retry-timeout branch 2 times, most recently from df55451 to d753dfe Compare January 27, 2026 06:57
@mhieta mhieta marked this pull request as ready for review January 27, 2026 07:10
@mhieta mhieta requested a review from a team as a code owner January 27, 2026 07:10
@azure-pipelines
Copy link

PALVELUKARTTA-API branch is deployed to platta: https://palvelukartta-api-pr374.dev.hel.ninja 🚀🚀🚀

@mhieta mhieta force-pushed the seer/feat/pk-get-retry-timeout branch from d753dfe to 2fc1ff4 Compare January 27, 2026 11:25
@mhieta mhieta marked this pull request as draft January 27, 2026 11:28
@azure-pipelines
Copy link

PALVELUKARTTA-API branch is deployed to platta: https://palvelukartta-api-pr374.dev.hel.ninja 🚀🚀🚀

@mhieta mhieta force-pushed the seer/feat/pk-get-retry-timeout branch from 2fc1ff4 to d14fcf2 Compare January 27, 2026 12:30
@mhieta mhieta force-pushed the seer/feat/pk-get-retry-timeout branch from d14fcf2 to fe29900 Compare January 27, 2026 12:39
@sonarqubecloud
Copy link

@mhieta mhieta marked this pull request as ready for review January 27, 2026 12:44
@mhieta mhieta requested a review from danipran January 27, 2026 12:44
Copy link
Contributor

@danipran danipran left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

@azure-pipelines
Copy link

PALVELUKARTTA-API branch is deployed to platta: https://palvelukartta-api-pr374.dev.hel.ninja 🚀🚀🚀

@mhieta mhieta merged commit 3835300 into main Jan 27, 2026
6 checks passed
@mhieta mhieta deleted the seer/feat/pk-get-retry-timeout branch January 27, 2026 13:03
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