Use v4 UUID instead of v1 for worker message IDs

This uses a purely random v4 UUID instead of a time-based v1 UUID for
the worker message IDs (which were introduced in
1a76a29ed2).

v1 UUID are based on current time and the hardware MAC address of the
machine where they are being generated (although the implementation in
the npm uuid module uses generates a random fake MAC address). As such
they have much more complex semantics than v4 UUIDs which are simply
randomly generated.

Unless there's a specific requirement for the special semantics of v1
UUIDs it is simpler and less error prone to simply go for v4 UUIDs
whenever just a unique identifier is needed.
pull/5244/head
Christoph Tavan 2019-07-21 14:34:20 +02:00 committed by Christopher Henn
parent c6f4fac67f
commit 039b093d18
1 changed files with 2 additions and 2 deletions

View File

@ -16,7 +16,7 @@ export const fetchData = async (msg: Message): Promise<any> => {
}
export const error = (msg: Message, err: Error) => {
const id = uuid.v1()
const id = uuid.v4()
postMessage({
id,
@ -27,7 +27,7 @@ export const error = (msg: Message, err: Error) => {
}
export const success = async (msg: Message, payload: any) => {
const id = uuid.v1()
const id = uuid.v4()
await DB.put(id, payload)