diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2019-08-13 15:14:33 +0200 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2019-08-14 11:34:44 +0200 |
commit | cee2f86d5724fcb073a8abdfbaf83869a8de85f1 (patch) | |
tree | 6dbc36417f1572caeca68aaa9ba91fc34a93de31 /app/models/concerns | |
parent | a55869483d023978655658d389aad36d63c9d2b2 (diff) | |
download | gitlab-ce-cee2f86d5724fcb073a8abdfbaf83869a8de85f1.tar.gz |
Optimise DAG processingoptimise-dag-processing
Diffstat (limited to 'app/models/concerns')
-rw-r--r-- | app/models/concerns/has_status.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/concerns/has_status.rb b/app/models/concerns/has_status.rb index 27a5c3d5286..71ebb586c13 100644 --- a/app/models/concerns/has_status.rb +++ b/app/models/concerns/has_status.rb @@ -106,10 +106,15 @@ module HasStatus scope :running_or_pending, -> { with_status(:running, :pending) } scope :finished, -> { with_status(:success, :failed, :canceled) } scope :failed_or_canceled, -> { with_status(:failed, :canceled) } + scope :incomplete, -> { without_statuses(completed_statuses) } scope :cancelable, -> do where(status: [:running, :preparing, :pending, :created, :scheduled]) end + + scope :without_statuses, -> (names) do + with_status(all_state_names - names.to_a) + end end def started? |