Skip to content

fix: Don't use getAddress in start/stop of local-discovery - #1136

Merged
RangerMauve merged 4 commits into
mainfrom
feat/local-discovery-simplify-port
Oct 14, 2025
Merged

fix: Don't use getAddress in start/stop of local-discovery#1136
RangerMauve merged 4 commits into
mainfrom
feat/local-discovery-simplify-port

Conversation

@RangerMauve

Copy link
Copy Markdown
Contributor

Part of #1092

This helped resolve an error where getAddress was being called before the server was initialized far enough that a port was available.

https://github.com/digidem/comapeo-core/pull/1092/files#diff-d8bdd8fc92679bb449fd7b40b9639551d54590cec4402c10bd4f03fa9c95c4b1L291

@RangerMauve
RangerMauve requested a review from gmaclennan October 8, 2025 21:54

@gmaclennan gmaclennan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think maybe return the port from #start(), then set this.#port in start(), to avoid the implicit expectation that #start() sets a class prop that start() then reads. Functionality will be the same, it's just more explicit for future maintenance here.

@RangerMauve

Copy link
Copy Markdown
Contributor Author

The stop-start-state-machine module doesn't allow for returning values from #start/#stop. https://www.npmjs.com/package/start-stop-state-machine#start

I could do the getAddress call inside start() instead.

@gmaclennan

Copy link
Copy Markdown
Member

The stop-start-state-machine module doesn't allow for returning values from #start/#stop. https://www.npmjs.com/package/start-stop-state-machine#start

I could do the getAddress call inside start() instead.

Ah ok, i should maybe fix that in the upstream module if possible. That was a bit of a nitpick anyway.

Doesn't calling getAddress inside start() revert to the original issue you were trying to fix here? I'm ok with merging this at 9a8e882

@RangerMauve

Copy link
Copy Markdown
Contributor Author

Agreed that we should go back to 9a8e882

Is there a chance the server could stop before .start() is resolved?

@RangerMauve
RangerMauve merged commit 9536490 into main Oct 14, 2025
11 checks passed
@RangerMauve
RangerMauve deleted the feat/local-discovery-simplify-port branch October 14, 2025 16:00
gmaclennan added a commit that referenced this pull request Oct 16, 2025
* main:
  fix: NO_ROLE should not sync config core (#1143)
  fix: Don't use getAddress in start/stop of local-discovery (#1136)
  chore: update drizzle to v1-beta.1 (#1140)
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