Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Failed to load latest commit information.|
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 tagbox.pl 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 tagbox.pl 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 tagbox.pl pushes onto the tagboxlog_feeder table. When there is accumulated data in that table that requires a user's tag count to be rewritten, tagbox.pl collects it and calls Slash::Tagbox::TagCountUser::run. That method returns data that tagbox.pl passes to setUser to write the new tag count for any affected users, and then deletes the used rows from tagboxlog_feeder. Purpose: 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. tagbox.pl'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 prioritized. 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...) Warning: All tagbox code is extremely beta and the API is subject to change in the weeks to come. (2006-06-27)