Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
57 lines (38 sloc) 2.2 KB
Definition: A tagbox monitors tag-related changes to a Slash site and
periodically emits updates to be applied to the database.
"Monitors tag-related changes": the task keeps track of
which tagboxes have been notified of which tags, tag changes, or
user-tag-related changes. When new information is available for a
tagbox, the task executes a method in that tagbox's class, and
pushes the data returned onto the tagboxlog_feeder table.
"Periodically emits updates": when a tagbox has sufficient entries
in the tagboxlog_feeder table to merit additional processing, its
run() method is executed and returns zero or more updates to apply
to tables in the Slash site's database.
Example: the TagCountUser tagbox counts how many active tags each
user has applied. The task scans the tags table and the
tags_deactivated table; when new entries in either are found, it
calls Slash::Tagbox::TagCountUser::feed_newtags or feed_deactivatedtags.
Those methods return data that pushes onto the tagboxlog_feeder
table. When there is accumulated data in that table that requires a
user's tag count to be rewritten, collects it and calls
Slash::Tagbox::TagCountUser::run. That method returns data that
passes to setUser to write the new tag count for any affected users, and
then deletes the used rows from tagboxlog_feeder.
This solves the following problems in the following ways:
Tags will be churning rapidly on our system and we want to see
the results of processing that data within seconds or minutes.'s main loop sleeps only for about 15 seconds, with
the rest of the time spent processing, and usually comes back
to the loop to re-evaluate priorities every 45-60 seconds.
It would require untenable resources to repeat all tagboxes'
processing with every new tag, so processing is queued and
Tagboxes are inherently complicated, but a consistent API means
a tagbox's class code is stripped-down, so most of its .pm file
is algorithm, not window-dressing.
(...explanation of the tables and algorithms to be written here...)
All tagbox code is extremely beta and the API is subject to
change in the weeks to come. (2006-06-27)
Something went wrong with that request. Please try again.