Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.
Originally posted by: xathrasHi,
We have a piece of code that runs on every graph we have. Its an audit log record loaded into our DB. Within the code, there is a node that renames a temporary BRD created by using the following parameters.
BRD Filename: {{^LogDirectory^}}/audit_log_{{^BRDHandle^}}
Log File = {{*LogDirectory*}}
BRDHandle = {{^Handle^}}.brd
After the temp file is written, a move node runs and does the following piece of code:
if
firstExec
then
"data".consume(true)
graphName = 'Graph Name'
oldFileName =
strcat(
"{{^BaseFileName^}}",
"_",
"{{^BRDHandle^}}"
)
newFileName =
strcat(
"{{^BaseFileName^}}",
"_",
graphName,
".brd"
)
oldFileName.appendBrd(newFileName)
oldFileName.deleteFile()
emit *
This issue is, lets say we have 5 graphs and they all run at the same time, and since they share this code, we get collisions whereby one graph is removing the file, shared by another until the rename. This causes a graph or graphs to fail.
How would one recommend we change the code to say in the Common Code that the temporary code is unique enough to prevent this from happening?
Regards
Wayne