Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F9169934
count "real" htmlCacheUpdate jobs
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
EBernhardson
Aug 24 2017, 11:55 PM
2017-08-24 23:55:56 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
count "real" htmlCacheUpdate jobs
View Options
<?php
$it
=
JobQueueGroup
::
singleton
()->
get
(
'htmlCacheUpdate'
)->
getAllQueuedJobs
();
$pending
=
0
;
$baseJobs
=
0
;
$emptyJobs
=
0
;
foreach
(
$it
as
$job
)
{
$new
=
countRealJobs
(
$job
);
if
(
$new
===
0
)
{
$emptyJobs
++;
}
else
{
$pending
+=
$new
;
$baseJobs
++;
}
if
((
$baseJobs
+
$emptyJobs
)
%
1000
===
0
)
{
$ratio
=
$pending
/
$baseJobs
;
echo
"Empty: $emptyJobs Jobs: $baseJobs Real: $pending Per real job: $ratio
\n
"
;
flush
();
if
(
$baseJobs
+
$emptyJobs
>=
50000
)
{
break
;
}
}
}
$ratio
=
$pending
/
$baseJobs
;
echo
"Empty: $emptyJobs Jobs: $baseJobs Real: $pending Per real job: $ratio
\n
"
;
function
countRealJobs
(
$job
)
{
global
$wgUpdateRowsPerJob
,
$wgUpdateRowsPerQuery
;
$queue
=
[
$job
];
$pending
=
0
;
$i
=
0
;
while
(
$queue
)
{
if
(++
$i
%
100
==
0
)
{
echo
"queue: "
,
$queue
,
" handled: $i
\n
"
;
flush
();
}
$job
=
array_pop
(
$queue
);
$params
=
$job
->
getParams
();
if
(
isset
(
$params
[
'table'
])
&&!
isset
(
$params
[
'pages'
]))
{
$params
[
'recursive'
]
=
true
;
}
if
(!
empty
(
$params
[
'recursive'
]))
{
$jobs
=
BacklinkJobUtils
::
partitionBacklinkJob
(
$job
,
$wgUpdateRowsPerJob
,
$wgUpdateRowsPerQuery
,
[]);
foreach
(
$jobs
as
$child
)
{
$queue
[]
=
$child
;
}
}
else
{
$pending
+=
$job
->
workItemCount
();
}
}
return
$pending
;
}
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4876199
Default Alt Text
count "real" htmlCacheUpdate jobs (1 KB)
Attached To
Mode
P5916 count "real" htmlCacheUpdate jobs
Attached
Detach File
Event Timeline
Log In to Comment