docs update
[lhc/web/wiklou.git] / docs / deferred.txt
1 deferred.txt
2
3 A few of the database updates required by various functions here
4 can be deferred until after the result page is displayed to the
5 user. For example, updating the view counts, updating the
6 linked-to tables after a save, etc. PHP does not yet have any
7 way to tell the server to actually return and disconnect while
8 still running these updates (as a Java servelet could), but it
9 might have such a feature in the future.
10
11 We handle these by creating a deferred-update object (in a real
12 O-O language these would be classes that implement an interface)
13 and putting those objects on a global list, then executing the
14 whole list after the page is displayed. We don't do anything
15 smart like collating updates to the same table or such because
16 the list is almost always going to have just one item on it, if
17 that, so it's not worth the trouble.
18
19
20 Since 1.6 there is a 'job queue' in the jobs table, which is used
21 to update link tables of transcluding pages after edits; this
22 may be extended in the future to more general background tasks.
23
24 Job queue items are fetched out of the queue and run either
25 at a random rate during regular page views (by default) or by
26 a batch process which can be run via maintenance/runJobs.php.
27
28 Currently there is some differents types of Jobs:
29
30 refreshLinks
31 Used to refresh the database tables that stores the links
32 beetween pages. When a page is cleared, all pages using these
33 page are also cleared by inseting a new job for all that pages.
34 Each job refresh only one page.
35
36 htmlCacheUpdate
37 clear caches when a template is changed to ensure that changes
38 can be see. Each job clear $wgUpdateRowsPerJob pages (500 by
39 default).
40
41 enotifNotify
42 used when $wgEnotifUseJobQ is true to send mails using the job
43 queue.