Just a minor suggestion: Replace "Foldable.foldMap return" with
"Foldable.toList", which is easier to understand.
Otherwise LGTM (no need to resend), thanks.


On Wed, Jan 8, 2014 at 11:03 AM, Klaus Aehlig <[email protected]> wrote:

> If the query fields don't require live data, we use the shortcut
> and don't request live data. However, we cannot take this shortcut
> if the fields the filter depends on requires live data.
>
> Signed-off-by: Klaus Aehlig <[email protected]>
> ---
>  src/Ganeti/Query/Query.hs | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/Ganeti/Query/Query.hs b/src/Ganeti/Query/Query.hs
> index f4ccef9..9f1a370 100644
> --- a/src/Ganeti/Query/Query.hs
> +++ b/src/Ganeti/Query/Query.hs
> @@ -58,6 +58,7 @@ module Ganeti.Query.Query
>  import Control.DeepSeq
>  import Control.Monad (filterM, foldM)
>  import Control.Monad.Trans (lift)
> +import Data.Foldable (foldMap)
>  import Data.List (intercalate)
>  import Data.Maybe (fromMaybe)
>  import qualified Data.Map as Map
> @@ -286,7 +287,9 @@ queryJobs cfg live fields qfilter =
>    cfilter <- resultT $ compileFilter Query.Job.fieldsMap qfilter
>    let selected = getSelectedFields Query.Job.fieldsMap fields
>        (fdefs, fgetters, _) = unzip3 selected
> -      live' = live && needsLiveData fgetters
> +      (_, filtergetters, _) = unzip3 . getSelectedFields
> Query.Job.fieldsMap
> +                                $ foldMap return qfilter
> +      live' = live && needsLiveData (fgetters ++ filtergetters)
>        disabled_data = Bad "live data disabled"
>    -- runs first pass of the filter, without a runtime context; this
>    -- will limit the jobs that we'll load from disk
> --
> 1.8.5.1
>
>

Reply via email to