BuildHistory

Hello,

I am employing BuildHistory in a plugin and would like to know the best way to go about selecting builds finished within a date range, given that the date filter members are either deprecated or bound to build type.

I want to be able to find all builds across all build types and projects that meet certain criteria, including when they finished.

What about BuildHistory#processEntries, does this optimize down to a single SQL query? Or does it fetch all entries and enumerate them?

Many thanks

<bb />

9 comments

Method processEntries works as follows:
- retrieves all data from the history table
- for each entry creates build and passes it into the item processor
- then if item processor returns false, stops processing

So it invokes single sql query, and retrieves all of the rows from the history, but it creates finished build instances lazily.

0

One correction, it creates instances lazily in 5.1 only, in 4.5 all build instances will be created. So in 5.1 this should work faster.

0

Ah, I see.

Is doing what I am doing considered wildly inefficient, then?

Should I dig deeper towards database?

<bb />

0

It depends on how often do you plan to call this code. As I told in 5.1 this should work faster, but chances are you will have an acceptable performance in 4.5 too.

0

I will be doing this every request, though I guess it won't change often so I can cache it.

By the way, is there a data cache bean anywhere built in?

<bb />

0

Well, there are caches, but they are mostly for recent history entries (i.e. for recently created builds) because these builds are used most often. The processEntries method does not use caches.

In your case I would try to call this method and then if performance is not acceptable decide whether any caches are needed. Or maybe you will be able to upgrade to 5.1, which should work faster in this place.

0

Okay thanks,

If I decide to implement memory caching, where should I look for implementation -- or should I do this myself?

<bb />

0

You can take a look at jetbrains.buildServer.util.RecentEntriesCache. It's a size limited cache implementation which drops entries that are rarely used.

0

Excellent, thanks very much

<bb />

0

Please sign in to leave a comment.