Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge "Generate private id for running instance"

  • Loading branch information...
commit 3179bec679a5097ba7e7c03e5385afd45d1e4a74 2 parents 5a88816 + 6dc1608
@anfernee anfernee authored Gerrit Code Review committed
View
9 lib/dea/instance.rb
@@ -217,6 +217,11 @@ def self.schema
optional("debug") => enum(nil, String),
optional("console") => enum(nil, bool),
+
+ # private_instance_id is internal id that represents the instance,
+ # which is generated by DEA itself. Currently, we broadcast it to
+ # all routers. Routers use that as sticky session of the instance.
+ "private_instance_id" => String,
}
end
end
@@ -269,6 +274,10 @@ def initialize(bootstrap, attributes)
# Generate unique ID
@attributes["instance_id"] ||= VCAP.secure_uuid
+
+ # Contatenate 2 UUIDs to genreate a 32 chars long private_instance_id
+ @attributes["private_instance_id"] ||= VCAP.secure_uuid + VCAP.secure_uuid
+
self.state = State::BORN
# Assume non-production app when not specified
View
3  lib/dea/router_client.rb
@@ -41,7 +41,8 @@ def generate_instance_request(instance, opts = {})
"tags" => {
"framework" => instance.framework_name,
"runtime" => instance.runtime_name,
- }
+ },
+ "private_instance_id" => instance.private_instance_id,
}
end
View
3  spec/dea/bootstrap/router_registration_spec.rb
@@ -50,7 +50,8 @@
"tags" => {
"framework" => instances[0].framework_name,
"runtime" => instances[0].runtime_name,
- }
+ },
+ "private_instance_id" => instances[0].private_instance_id,
}
expected_1 = {
Please sign in to comment.
Something went wrong with that request. Please try again.