[Toolserver-l] Toolserver countdown
Ilmari Karonen
nospam at vyznev.net
Mon Apr 12 22:11:31 UTC 2010
Delphine Ménard wrote:
> Hi, can anyone give us some info on how the countdown works?
>
> Is it really counting edits? Anything else?
>
> ---------- Forwarded message ----------
> From: Jay Walsh <jwalsh at wikimedia.org>
> Date: Mon, Apr 12, 2010 at 8:00 PM
> Subject: Re: [Wmfcc-l] a few days...
>
> Can anyone confirm the specifics around the toolserver app doing this countdown?
> http://toolserver.org/~emijrp/wikimediacounter/
> The speed that it moves up is a bit predictable. I'd like to draw
> some attention to it, but need a bit of background before we get
> there. Seems to me like the 10s are moving up in 1 second increments.
Why not just ask emijrp -- it's his script.
Anyway, the animation is done in JavaScript, so you can just look at the
source to see what it's doing. The relevant part is
var editinit=997162411;
var timeinit=1271109001000;
var timenow=new Date().getTime();
var period=1000/10; // period update in miliseconds
var editrate=0.010; //per milisecond
The editinit and timeinit values increase when you reload the page, as
one might expect. I haven't seem any change in the editrate value, but
that could be either because it's just pulled out of a hat (it does look
suspiciously round) or because it's a long-term average.
It probably wouldn't be too hard to write a better "real-time" edit
counter. For example, one could make it do an AJAX request back to to
server, say, every minute or so to adjust the rate to match reality.
Also, making the intervals between increments Poisson-distributed would
look more realistic that having them stay constant, although of course
the individual "edits" would still be fake.
In principle, it should also be possible to make a true live Wikimedia
edit counter: all you'd need to do is subscribe to the IRC RecentChanges
feed and condense it down to some suitably low-bandwidth, low-latency
format for transmitting to the browser. I'm not sure how practical that
would be with plain old AJAX, though (you really don't want to make a
new request for every edit), but Java or Flash or something like that
ought to handle it fine.
--
Ilmari Karonen
More information about the Toolserver-l
mailing list