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

Use UUID for p:episode, rather than ms-resolution timestamp, … #286

Closed
wants to merge 1 commit into
base: saxon98
from

Conversation

Projects
None yet
2 participants
@Conal-Tuohy
Copy link
Contributor

Conal-Tuohy commented Jan 15, 2019

…to guarantee unique identifiers in a multi-threaded environment.

I've been running XMLCalabash embedded in a web-server environment to implement a "web API". During load testing with multiple simultaneous requests to the API pipeline I managed to invoke it several times per millisecond, and I found that the p:episode function was returning the same value in such cases, though the spec says the values should be different:

Returns a string which should be unique for each invocation of the pipeline processor. In other words, if a processor is run several times in succession, or if several processors are running simultaneously, each invocation of each processor should get a distinct value from p:episode.

I had been using the value of p:episode as a unique id for logging each individual call to the API pipeline, and the identifier collisions broke that; that's how I discovered the problem.

Use UUID for p:episode, rather than ms-resolution timestamp, to guara…
…ntee unique identifiers in a multi-threaded environment

ndw added a commit that referenced this pull request Jan 18, 2019

ndw added a commit that referenced this pull request Jan 18, 2019

@ndw

This comment has been minimized.

Copy link
Owner

ndw commented Jan 18, 2019

Apologies. I saw a snippet of this in email and implemented a different solution before noticing that you'd sent a PR. Thank you for the PR!

@ndw ndw closed this Jan 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment