Code review comment for lp:~gmb/launchpad/heat-garbo-hourly-bug-509195

Revision history for this message
Abel Deuring (adeuring) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Graham,

nice banch! I have just two nitpicks, see below.

Abel

> === modified file 'lib/lp/bugs/doc/bug-heat.txt'
> --- lib/lp/bugs/doc/bug-heat.txt 2010-03-03 13:10:17 +0000
> +++ lib/lp/bugs/doc/bug-heat.txt 2010-03-05 10:13:32 +0000

[...]

> +it as a method will add jobs to calculate the heat of for all the bugs
> +whose heat is more than seven days old.

I think one of ('of', 'for') is sufficient ;)

> +
> +Before update_bug_heat is called, we'll ensure that there are no waiting
> +jobs in the bug heat calculation queue.
> +
> + >>> from lp.bugs.interfaces.bugjob import ICalculateBugHeatJobSource
> + >>> for calc_job in
getUtility(ICalculateBugHeatJobSource).iterReady():
> + ... calc_job.job.start()
> + ... calc_job.job.complete()
> +
> + >>> ready_jobs =
list(getUtility(ICalculateBugHeatJobSource).iterReady())
> + >>> len(ready_jobs)
> + 0
> +
> +We need to commit here to ensure that the bugs we've created are
> +available to the update_bug_heat script.
> +
> + >>> import transaction
> + >>> transaction.commit()
> +
> + >>> getUtility(IBugSet).getBugsWithOutdatedHeat(1).count()
> + 2
> +
> +We need to run update_bug_heat() twice to ensure that both the bugs are
> +updated.

I think you call update_bug_heat() in this doc test only once. But it
seems it should be called with chunksize=2 to ensure both bugs are
processed.

> +
> + >>> update_bug_heat(chunk_size=2)
> + DEBUG Adding CalculateBugHeatJobs for 2 Bugs (starting id: ...)
> + DEBUG Adding CalculateBugHeatJob for bug ...
> + DEBUG Adding CalculateBugHeatJob for bug ...

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFLkODxekBPhm8NrtARApukAJoCrVwFFnMkn4bR+JHA6lbUGQaZigCgkHXF
ARR5bSLClYT7Elxqmb/8X7o=
=+2Ba
-----END PGP SIGNATURE-----

« Back to merge proposal