pelias / pelias/api

Add some retries to type mapping discovery?

Open
#1,591 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
259
Forks
168
Avg merge
6h 15m
Merged PRs (30d)
1

Description

A helpful but sometimes confusing part of the APIs behavior is that it queries Elasticsearch on startup to get the list of custom sources and layers.

We had a report from a Pelias user with custom layers that they were no longer seeing them after running pelias compose down && pelias compose up. It turned out that telling both the API and Elasticsearch to start up at the same time doesn't work. The API's initial query to Elasticsearch will fail, so it won't detect any custom sources and layers.

While we have the pelias elastic wait command to help with this, the "safe" way to stop and start all Pelias components is rather verbose: pelias compose kill && pelias elastic start && pelias elastic wait && pelias compose up.

What if instead we added a couple retries to the API's Elasticsearch request? Elasticsearch usually starts up within a few seconds, and then the call to detect custom sources and layers would work fine.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the API startup code that queries Elasticsearch to discover custom sources and layers, then read how request failures are handled. Confirm the behavior when Elasticsearch is unavailable during startup and define completion as retrying the discovery request so it succeeds when Elasticsearch becomes ready.

Written by the indexing model from the issue text.

Assessment

Tech stack
elasticsearch, javascript
Domain
api, backend, search
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.