launchpad-dev team mailing list archive
Mailing list archive
Re: Bug heat and the API
On 2 March 2010 15:05, James Westby <jw+debian@xxxxxxxxxxxxxxx> wrote:
> With the addition of bug heat there's a danger of a little trap being
> inadvertently set for those using the API.
> If bug_heat is exported as an attribute over the API then it goes in to
> the calculation of the etag for a bug. That means that bug_heat, like
> status, importance, etc. can't change between GETting the bug over the
> API and PATCHing new values to it.
> However, as bug_heat is decayed using cron it will race with all
> modifications done over the API, meaning that you will occaisionally get
> 412 errors from your scripts.
> There would be a couple of ways of fixing this, such as exporting
> bug_heat as a method not as an attribute.
There was another similar problem recently, but I can't recall the details.
I agree that making it a method would be the quickest fix, but it
feels more natural as an attribute.
A way to mark attributes as volatile - and thus not included in etag
calculations - could be one solution (i.e. an export decorator). I
guess this would need support in lazr.restfulclient though. That would
open the door to exporting other aggregate or derived model properties
as attributes, though that might not always be a good idea.