Skip to content

fix: skip internal FalkorDB when FALKORDB_HOST is external#601

Merged
gkorland merged 3 commits into
stagingfrom
fix/skip-internal-falkordb-when-external
Mar 10, 2026
Merged

fix: skip internal FalkorDB when FALKORDB_HOST is external#601
gkorland merged 3 commits into
stagingfrom
fix/skip-internal-falkordb-when-external

Conversation

@gkorland

@gkorland gkorland commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

Problem

When running via docker-compose, FalkorDB is a separate service and FALKORDB_HOST is set to its service name (e.g. falkordb). However, start.sh unconditionally started an internal FalkorDB instance, wasting resources.

Fix

Only start the internal FalkorDB instance when FALKORDB_HOST is localhost (standalone container mode). In compose mode, where FALKORDB_HOST points to the external service, it is skipped.

  • Standalone docker run: FALKORDB_HOST defaults to localhost → internal FalkorDB starts ✅
  • Docker Compose: FALKORDB_HOST=falkordb → internal FalkorDB is skipped ✅

Summary by CodeRabbit

  • Chores
    • Modified startup behavior to conditionally initialize the database only for local configurations, improving startup efficiency when using remote database settings.

When running via docker-compose, FalkorDB is a separate service and
FALKORDB_HOST is set to its service name (not localhost). Previously
start.sh always started an internal FalkorDB instance regardless,
wasting resources. Now it only starts the internal instance when
FALKORDB_HOST is localhost (standalone container mode).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vercel

vercel Bot commented Mar 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
code-graph Error Error Mar 10, 2026 8:53pm

Request Review

@coderabbitai

coderabbitai Bot commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@gkorland has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 22 minutes and 1 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 248c1c87-ad46-4dfa-bba6-c6ba29393d5c

📥 Commits

Reviewing files that changed from the base of the PR and between 5e0f585 and ede7dc4.

📒 Files selected for processing (1)
  • start.sh
📝 Walkthrough

Walkthrough

Modified startup script to conditionally launch FalkorDB Redis based on the FALKORDB_HOST environment variable. When the host is localhost, the redis-server starts; otherwise, startup is skipped while preserving the existing wait-for-ready logic and Flask initialization.

Changes

Cohort / File(s) Summary
Startup Configuration
start.sh
Added conditional check to only start redis-server when FALKORDB_HOST equals localhost, otherwise skip Redis startup while maintaining subsequent startup sequence.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A clever twist in startup's dance,
Where localhost gets its Redis chance,
Remote hosts skip the server's call,
Conditional logic serves us all! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: making FalkorDB startup conditional based on FALKORDB_HOST value, distinguishing between localhost and external configurations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/skip-internal-falkordb-when-external

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
start.sh (1)

16-18: Pre-existing: Wait loop has no timeout.

Not introduced by this PR, but worth noting for operational resilience: if the external FalkorDB service is unavailable or misconfigured, this loop will wait indefinitely. Consider adding a timeout with a failure message for easier debugging in compose environments.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@start.sh` around lines 16 - 18, The wait loop in start.sh using nc -z against
$FALKORDB_HOST and $FALKORDB_PORT can block forever; add a configurable timeout
(e.g. FALKORDB_WAIT_TIMEOUT env var) and track elapsed time inside the loop
(using SECONDS or timestamp arithmetic) so that if the timeout is exceeded you
log a clear error mentioning FALKORDB_HOST and FALKORDB_PORT and exit non‑zero;
alternatively use the timeout command to wrap nc, but ensure you emit a failure
message and non‑zero exit when the service is unreachable.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@start.sh`:
- Around line 8-11: The script only treats FALKORDB_HOST=="localhost" as local;
update the conditional around starting the internal Redis (the block that runs
redis-server --loadmodule /var/lib/falkordb/bin/falkordb.so | cat &) to also
detect loopback addresses (e.g., "127.0.0.1") — check FALKORDB_HOST for either
"localhost" or "127.0.0.1" (or more broadly any value that matches
/^127\.0\.0\.\d+$/) and start the internal FalkorDB when matched so the wait
loop doesn't hang trying to reach an external host.

---

Nitpick comments:
In `@start.sh`:
- Around line 16-18: The wait loop in start.sh using nc -z against
$FALKORDB_HOST and $FALKORDB_PORT can block forever; add a configurable timeout
(e.g. FALKORDB_WAIT_TIMEOUT env var) and track elapsed time inside the loop
(using SECONDS or timestamp arithmetic) so that if the timeout is exceeded you
log a clear error mentioning FALKORDB_HOST and FALKORDB_PORT and exit non‑zero;
alternatively use the timeout command to wrap nc, but ensure you emit a failure
message and non‑zero exit when the service is unreachable.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cb29772d-24d2-443c-ad4c-6a44ca542525

📥 Commits

Reviewing files that changed from the base of the PR and between 17d1471 and 5e0f585.

📒 Files selected for processing (1)
  • start.sh

Comment thread start.sh Outdated
The previous check only matched 'localhost'. Any loopback address like
127.0.0.1 should also start the internal FalkorDB instance instead of
waiting on an unreachable external host.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The wait loop could block forever if FalkorDB never became reachable.
Now uses FALKORDB_WAIT_TIMEOUT (default 30s) via the bash SECONDS
variable to track elapsed time, logging a clear error message and
exiting non-zero if the timeout is exceeded.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@gkorland gkorland merged commit ba4e288 into staging Mar 10, 2026
13 of 14 checks passed
@gkorland gkorland deleted the fix/skip-internal-falkordb-when-external branch March 10, 2026 20:56
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.

1 participant