accesslib: mark_context_dirty() - fix race condition

We had a 1s race condition where a user could get their rights loaded
at the exact time an admin is changing roles/caps and see the "old"
data. Or even see a half-updated view of the access controls.

Yuck.

So we fix the race condition backdating the dirtyness. Cheap, but
effective. And then we backdate it some more to cover for minor clock
flutter on clusters (you still need ntp however!).
This commit is contained in:
martinlanghoff
2007-09-19 07:23:01 +00:00
parent 16cb1ef759
commit 8e9fa6b1a2
+4 -1
View File
@@ -4978,7 +4978,10 @@ function mark_context_dirty($path) {
// only if it is a non-empty string
if (is_string($path) && $path !== '') {
set_config($path, time(), 'accesslib/dirtycontexts');
// The timestamp is 2s in the past to cover for
// - race conditions within the 1s granularity
// - very small clock offsets in clusters (use ntpd!)
set_config($path, time()-2, 'accesslib/dirtycontexts');
}
}