Skip to content

Commit

Permalink
Use default future execution configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
JurajKubelka committed Nov 6, 2024
1 parent 5b1188f commit a007f71
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
7 changes: 4 additions & 3 deletions src/GToolkit-Pharo-Coder-AddOns/ProtoObject.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ProtoObject >> gtAdviceActionFor: anAction [
cached.
^ anAction explicit
priority: 0;
stencil: [ | button dropDownAptitude |
stencil: [ | button dropDownAptitude promise |
button := GtFixItButton new.
button visibility: BlVisibility hidden.
button label: 'Advice'.
Expand All @@ -35,11 +35,12 @@ ProtoObject >> gtAdviceActionFor: anAction [
element ].
button aptitude: BrGlamorousButtonWithIconAptitude + dropDownAptitude.
button icon: BrGlamorousVectorIcons repair.
(actionStream asyncSimilarCopy hasNext
promise := (actionStream asyncSimilarCopy hasNext
then: [ :bool |
bool
ifTrue: [ button
enqueueTask: (BlTaskAction new action: [ button visibility: BlVisibility visible ]) ] ])
await.
await: GtSingleCoderViewModel addOnsExecutionConfiguration.
button enqueueTask: (BlPromiseTask new promise: promise).
button ]
]
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,17 @@ GtPharoBehaviorCoderNameElement >> addAddOnsElementIn: aContainer [
GtPharoBehaviorCoderNameElement >> addAdviceDropDownIn: aContainer [
behaviorCoderViewModel behavior
ifNotNil: [ :class |
| adviceStream |
| adviceStream future promise |
adviceStream := ((GtAdvice adviceForClass: class) asAsyncStream
select: [ :each | each hasAdvice ]) cached.
(adviceStream asyncSimilarCopy hasNext
future := (adviceStream asyncSimilarCopy hasNext
then: [ :bool |
bool ifTrue: [
aContainer enqueueTask: (BlTaskAction new
action: [ aContainer addChild: (self
buildAdviceListFor: adviceStream asyncSimilarCopy) ]) ] ]) await ]
buildAdviceListFor: adviceStream asyncSimilarCopy) ]) ] ]).
promise := future await: GtSingleCoderViewModel addOnsExecutionConfiguration.
self enqueueTask: (BlPromiseTask new promise: promise) ]
]

{ #category : #accessing }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ GtAsyncSearchMethodGroupStream >> metrics [
<return: #TAsyncFuture>
| metrics |
metrics := GtAsyncSearchMethodGroupMetrics new.
(self filteredItemsStream forEach: [ :eachMethod | metrics accumulateMethod: eachMethod ]) await.
(self filteredItemsStream forEach: [ :eachMethod | metrics accumulateMethod: eachMethod ])
await: GtSearchConfiguration defaultFutureExecutionConfiguration.
^ metrics
]
12 changes: 12 additions & 0 deletions src/GToolkit-Pharo-SearchFilters/GtSearchConfiguration.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Class {
#name : #GtSearchConfiguration,
#superclass : #Object,
#category : #'GToolkit-Pharo-SearchFilters-Support'
}

{ #category : #'api - configuration' }
GtSearchConfiguration class >> defaultFutureExecutionConfiguration [
^ AsyncFutureExecutionConfiguration new
defaultPriority;
customGroup: #Filters
]

0 comments on commit a007f71

Please sign in to comment.