-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix concurrency issue on virtual router #1465
Conversation
Backported from Cosmic.
@@ -91,7 +91,7 @@ do | |||
done < $cfg | |||
|
|||
#remove the configuration file, log file should have all the records as well | |||
rm -f $cfg | |||
mv $cfg /var/cache/cloud/processed/ |
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.
Do we know this will get cleaned?
code LGTM running integration suite |
@DaanHoogland This can be pointed towards 4.7 so I will close this and open one to 4.7 instead of master. |
@@ -104,13 +109,25 @@ public static AbstractConfigItemFacade getInstance(final Class<? extends Network | |||
return instance; | |||
} | |||
|
|||
|
|||
private static String appendUuidToJsonFiles(final String filename) { | |||
String remoteFileName = new String(filename); |
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.
Why are is a new String(filename)
being done? This avoids the constant pool, and is extremely expensive. Consider the following usage of StringBuilder
to avoid unnecessary pressure on the String
constant pool due to the new
call and string concatenation:
final StringBuilder remoteFileName = new StringBuilder(filename);
if (filename.endWith("json")) {
remoteFileName.append(".");
remoteFileName.append(UUID.randomUUID()); // implicit call to toString
}
return remoteFileName.toString();
it was already started :( |
The json files now have UUIDs to prevent them from getting overwritten before they've been executed. Prevents config to be pushed to the wrong router :-s
On the router: