-
Notifications
You must be signed in to change notification settings - Fork 20
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
Simplify RuntimeContainer #178
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! I like this. A bit of a mental trip to change over and think of RuntimeContainer as actually just a string with an extra method (so RuntimeContainer.new
is really just String.new
) but I think it's clever!
instance_number = split(".")[1].to_i | ||
instance_number > 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this working off the basis that nil.to_i
is 0
? 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clever 😁
@api_base_url ||= "https://adapter.judoscale.com/api/#{ENV["RENDER_SERVICE_ID"]}" | ||
elsif ENV["DYNO"] | ||
service_name, instance = ENV["DYNO"].split "." | ||
@current_runtime_container = RuntimeContainer.new service_name, instance | ||
@current_runtime_container = RuntimeContainer.new ENV["DYNO"] | ||
else | ||
# unsupported platform? Don't want to leave @current_runtime_container nil though |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to drop this comment now 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it no longer valid? I still found it helpful, assuming we don't want @current_runtime_container
to be nil.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't, but the "unsupported platform" bit isn't a valid assumption anymore, now that we know there are platforms which the correct functionality is to have the bare RuntimeContainer.new
🤔 so maybe just the first 2 words of the comment 😆
We have no use for `service_name`, so we can treat the runtime container as just the container ID.
be6aeda
to
4563363
Compare
We have no use for
service_name
, so we can treat the runtime container as just the container ID. This also preps us for ECS, where we don't have access to the service name.