From a97e70f112b169703850fa29ec413140da627d48 Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Wed, 6 Nov 2024 15:46:39 -0300 Subject: [PATCH] Set `BrFromFuture`'s future execution configuration --- src/Brick/BrFromFuture.class.st | 2 +- src/Brick/BrFutureHandler.class.st | 23 +++++++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/Brick/BrFromFuture.class.st b/src/Brick/BrFromFuture.class.st index ad66a465a..ab220a369 100644 --- a/src/Brick/BrFromFuture.class.st +++ b/src/Brick/BrFromFuture.class.st @@ -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 | diff --git a/src/Brick/BrFutureHandler.class.st b/src/Brick/BrFutureHandler.class.st index c8dca139a..f6dcfbaeb 100644 --- a/src/Brick/BrFutureHandler.class.st +++ b/src/Brick/BrFutureHandler.class.st @@ -4,7 +4,8 @@ Class { #instVars : [ 'future', 'action', - 'monitor' + 'monitor', + 'configuration' ], #category : #'Brick-Future - Support' } @@ -14,6 +15,24 @@ BrFutureHandler >> action: aBlockOrMessageSend [ action := aBlockOrMessageSend ] +{ #category : #accessing } +BrFutureHandler >> configuration [ + + ^ 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. @@ -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