Skip to content

Commit

Permalink
Set BrFromFuture's future execution configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
JurajKubelka committed Nov 6, 2024
1 parent 11dddda commit a97e70f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Brick/BrFromFuture.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ BrFromFuture >> onAddedToSceneGraph [

self privateUpdateElement.

futureExecution := future await.
futureExecution := future await: self configuration.
promise := futureExecution
then: [ :aResult | self privateDataSnapshot: (BrFromFutureDataSnapshot new setData: aResult) ]
otherwise: [ :anError |
Expand Down
23 changes: 21 additions & 2 deletions src/Brick/BrFutureHandler.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Class {
#instVars : [
'future',
'action',
'monitor'
'monitor',
'configuration'
],
#category : #'Brick-Future - Support'
}
Expand All @@ -14,6 +15,24 @@ BrFutureHandler >> action: aBlockOrMessageSend [
action := aBlockOrMessageSend
]

{ #category : #accessing }
BrFutureHandler >> configuration [
<return: #AsyncFutureExecutionConfiguration>
^ configuration ifNil: [ configuration := self defaultConfiguration ]
]

{ #category : #accessing }
BrFutureHandler >> configuration: aAsyncFutureExecutionConfiguration [
configuration := aAsyncFutureExecutionConfiguration
]

{ #category : #initialization }
BrFutureHandler >> defaultConfiguration [
^ AsyncFutureExecutionConfiguration new
customGroup: #UI;
highPriority
]

{ #category : #initialization }
BrFutureHandler >> initialize [
super initialize.
Expand All @@ -37,7 +56,7 @@ BrFutureHandler >> updateWithFuture: aFuture [
future := nil.
action cull: theCurrentResult cull: true ]
ifFalse: [
future await
(future await: self configuration)
then: [ :aResult |
monitor critical: [
future == aFuture
Expand Down

0 comments on commit a97e70f

Please sign in to comment.