Saq,

I have solved this problem in the past simply by including milliseconds in 
the time stamp however before using the "new title" check it does not 
exist, increment the milliseconds and check again. No one cares if the 
milliseconds are not totally accurate, you could even increment with a 
random number to reduce collisions ( at most they need only that they 
reflect chronological orde)r. Given 1000 per second are available this 
should not be an issue, and in fact 99.99% of the time the first title is 
usable, however it is important to ensure the timestamp value is 
re-evaluated at the last possible moment.

Personally I feel incrementing a value to obtain the next tiddlername is a 
better than timestamp method, but that just a view point. I am looking 
eventually to produce a generic solution for this as there are many ways to 
make use of this code patterns not only for unique serial numbers but 
initial set/queue order FIFO LIFO and more, with less bytes needed.

Regards
Tones

On Friday, 4 December 2020 at 04:27:48 UTC+11 [email protected] wrote:

> So the bug that Dom reported is very interesting and others may find it of 
> interest.
>
> The underlying problem is that we are creating several tiddlers at the 
> same time via action-widgets, and the tiddler titles rely on a timestamp to 
> make them unique. However, the tiddlers are sometimes created so quickly 
> that they are not unique!
>
> There have been discussions on this group in the past on the merits of 
> using timestamps for tiddler titles and this is a good reminder that they 
> just aren't specific enough to serve as a proper unique identifier.
>
> I am going to have take a moment and think about the best way to resolve 
> this. I know users prefer timestamps to randomly generated UUIDs so I have 
> to consider if there is a middle ground.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/21b2fb69-d141-4c1f-8629-8389262346d9n%40googlegroups.com.

Reply via email to