Skip to content

Update dispatch url used in examples to dummy #150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async def create_actor(dispatch: DispatchInfo, receiver: Receiver[DispatchInfo])
return MagicMock(dispatch=dispatch, receiver=receiver)

async def run():
url = os.getenv("DISPATCH_API_URL", "grpc://fz-0004.frequenz.io:50051")
url = os.getenv("DISPATCH_API_URL", "grpc://dispatch.url.goes.here.example.com")
key = os.getenv("DISPATCH_API_KEY", "some-key")

microgrid_id = 1
Expand Down
2 changes: 1 addition & 1 deletion src/frequenz/dispatch/_actor_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def _update_dispatch_information(self, dispatch_update: DispatchInfo) -> None:
)

async def main():
url = os.getenv("DISPATCH_API_URL", "grpc://fz-0004.frequenz.io:50051")
url = os.getenv("DISPATCH_API_URL", "grpc://dispatch.url.goes.here.example.com")
Copy link
Preview

Copilot AI May 15, 2025

Choose a reason for hiding this comment

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

[nitpick] Similar to other changes, the repeated assignment of the default dispatch URL could be consolidated into a common module or constant for better maintainability.

Suggested change
url = os.getenv("DISPATCH_API_URL", "grpc://dispatch.url.goes.here.example.com")
url = os.getenv("DISPATCH_API_URL", DEFAULT_DISPATCH_URL)

Copilot uses AI. Check for mistakes.

key = os.getenv("DISPATCH_API_KEY", "some-key")

microgrid_id = 1
Expand Down
8 changes: 4 additions & 4 deletions src/frequenz/dispatch/_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async def create_actor(dispatch: DispatchInfo, receiver: Receiver[DispatchInfo])
return MagicMock(dispatch=dispatch, receiver=receiver)

async def run():
url = os.getenv("DISPATCH_API_URL", "grpc://fz-0004.frequenz.io:50051")
url = os.getenv("DISPATCH_API_URL", "grpc://dispatch.url.goes.here.example.com")
Copy link
Preview

Copilot AI May 15, 2025

Choose a reason for hiding this comment

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

[nitpick] The default dispatch URL assignment appears in multiple run functions; consider centralizing this logic (for example, via a helper or a shared constant) to simplify future updates.

Suggested change
url = os.getenv("DISPATCH_API_URL", "grpc://dispatch.url.goes.here.example.com")
url = os.getenv("DISPATCH_API_URL", DEFAULT_DISPATCH_URL)

Copilot uses AI. Check for mistakes.

key = os.getenv("DISPATCH_API_KEY", "some-key")

microgrid_id = 1
Expand All @@ -81,7 +81,7 @@ async def run():
from unittest.mock import MagicMock

async def run():
url = os.getenv("DISPATCH_API_URL", "grpc://fz-0004.frequenz.io:50051")
url = os.getenv("DISPATCH_API_URL", "grpc://dispatch.url.goes.here.example.com")
key = os.getenv("DISPATCH_API_KEY", "some-key")

microgrid_id = 1
Expand Down Expand Up @@ -126,7 +126,7 @@ async def run():
from frequenz.dispatch import Created, Deleted, Dispatcher, Updated

async def run():
url = os.getenv("DISPATCH_API_URL", "grpc://fz-0004.frequenz.io:50051")
url = os.getenv("DISPATCH_API_URL", "grpc://dispatch.url.goes.here.example.com")
key = os.getenv("DISPATCH_API_KEY", "some-key")

microgrid_id = 1
Expand Down Expand Up @@ -163,7 +163,7 @@ async def run():
from frequenz.dispatch import Dispatcher

async def run():
url = os.getenv("DISPATCH_API_URL", "grpc://fz-0004.frequenz.io:50051")
url = os.getenv("DISPATCH_API_URL", "grpc://dispatch.url.goes.here.example.com")
key = os.getenv("DISPATCH_API_KEY", "some-key")

microgrid_id = 1
Expand Down
Loading