Skip to content

Commit 142d227

Browse files
committed
More long->background rename
1 parent 5dc63d0 commit 142d227

File tree

5 files changed

+28
-20
lines changed

5 files changed

+28
-20
lines changed

dash/_callback.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def callback(
197197
config_prevent_initial_callbacks,
198198
*_args,
199199
**_kwargs,
200-
long=background_spec,
200+
background=background_spec,
201201
manager=manager,
202202
running=running,
203203
on_error=on_error,
@@ -241,7 +241,7 @@ def insert_callback(
241241
state,
242242
inputs_state_indices,
243243
prevent_initial_call,
244-
long=None,
244+
background=None,
245245
manager=None,
246246
running=None,
247247
dynamic_creator: Optional[bool] = False,
@@ -263,9 +263,9 @@ def insert_callback(
263263
# prevent_initial_call can be a string "initial_duplicates"
264264
# which should not prevent the initial call.
265265
"prevent_initial_call": prevent_initial_call is True,
266-
"long": long
266+
"background": background
267267
and {
268-
"interval": long["interval"],
268+
"interval": background["interval"],
269269
},
270270
"dynamic_creator": dynamic_creator,
271271
"no_output": no_output,
@@ -278,7 +278,7 @@ def insert_callback(
278278
"state": callback_spec["state"],
279279
"outputs_indices": outputs_indices,
280280
"inputs_state_indices": inputs_state_indices,
281-
"long": long,
281+
"background": background,
282282
"output": output,
283283
"raw_inputs": inputs,
284284
"manager": manager,
@@ -320,7 +320,7 @@ def register_callback(
320320
multi = True
321321
has_output = len(output) > 0
322322

323-
background = _kwargs.get("long")
323+
background = _kwargs.get("background")
324324
manager = _kwargs.get("manager")
325325
running = _kwargs.get("running")
326326
on_error = _kwargs.get("on_error")
@@ -344,7 +344,7 @@ def register_callback(
344344
flat_state,
345345
inputs_state_indices,
346346
prevent_initial_call,
347-
long=background,
347+
background=background,
348348
manager=manager,
349349
dynamic_creator=allow_dynamic_callbacks,
350350
running=running,

dash/_validate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,8 @@ def validate_background_callbacks(callback_map):
538538
input_indexed.setdefault(o, set())
539539
input_indexed[o].update(coerce_to_list(callback["raw_inputs"]))
540540

541-
for callback in (x for x in callback_map.values() if x.get("long")):
542-
bg_info = callback["long"]
541+
for callback in (x for x in callback_map.values() if x.get("background")):
542+
bg_info = callback["background"]
543543
progress = bg_info.get("progress", [])
544544
running = bg_info.get("running", [])
545545

dash/dash-renderer/src/actions/callbacks.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {
2929
IStoredCallback,
3030
IBlockedCallback,
3131
IPrioritizedCallback,
32-
LongCallbackInfo,
32+
BackgroundCallbackInfo,
3333
CallbackResponse,
3434
CallbackResponseData,
3535
SideUpdateOutput
@@ -413,7 +413,7 @@ function handleServerside(
413413
hooks: any,
414414
config: any,
415415
payload: ICallbackPayload,
416-
long: LongCallbackInfo | undefined,
416+
background: BackgroundCallbackInfo | undefined,
417417
additionalArgs: [string, string, boolean?][] | undefined,
418418
getState: any,
419419
output: string,
@@ -578,7 +578,7 @@ function handleServerside(
578578
progressDefault = data.progressDefault;
579579
}
580580

581-
if (!long || data.response !== undefined) {
581+
if (!background || data.response !== undefined) {
582582
if (data.dist) {
583583
Promise.all(data.dist.map(loadLibrary)).then(() => {
584584
completeJob();
@@ -592,7 +592,9 @@ function handleServerside(
592592
// Poll chain.
593593
setTimeout(
594594
handle,
595-
long.interval !== undefined ? long.interval : 500
595+
background.interval !== undefined
596+
? background.interval
597+
: 500
596598
);
597599
}
598600
});
@@ -679,8 +681,14 @@ export function executeCallback(
679681
dispatch: any,
680682
getState: any
681683
): IExecutingCallback {
682-
const {output, inputs, state, clientside_function, long, dynamic_creator} =
683-
cb.callback;
684+
const {
685+
output,
686+
inputs,
687+
state,
688+
clientside_function,
689+
background,
690+
dynamic_creator
691+
} = cb.callback;
684692
try {
685693
const inVals = fillVals(paths, layout, cb, inputs, 'Input', true);
686694

@@ -797,7 +805,7 @@ export function executeCallback(
797805
hooks,
798806
newConfig,
799807
payload,
800-
long,
808+
background,
801809
additionalArgs.length ? additionalArgs : undefined,
802810
getState,
803811
cb.callback.output,

dash/dash-renderer/src/types/callbacks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export interface ICallbackDefinition {
1111
outputs: ICallbackProperty[];
1212
prevent_initial_call: boolean;
1313
state: ICallbackProperty[];
14-
long?: LongCallbackInfo;
14+
background?: BackgroundCallbackInfo;
1515
dynamic_creator?: boolean;
1616
running: any;
1717
no_output?: boolean;
@@ -85,7 +85,7 @@ export type CallbackResult = {
8585
payload: ICallbackPayload | null;
8686
};
8787

88-
export type LongCallbackInfo = {
88+
export type BackgroundCallbackInfo = {
8989
interval?: number;
9090
progress?: any;
9191
running?: any;

dash/dash.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,7 +1308,7 @@ def dispatch(self):
13081308
g.background_callback_manager = (
13091309
cb.get("manager") or self._background_manager
13101310
)
1311-
g.ignore_register_page = cb.get("long", False)
1311+
g.ignore_register_page = cb.get("background", False)
13121312

13131313
# Add args_grouping
13141314
inputs_state_indices = cb["inputs_state_indices"]
@@ -1436,7 +1436,7 @@ def _setup_server(self):
14361436
cancels = {}
14371437

14381438
for callback in self.callback_map.values():
1439-
background = callback.get("long")
1439+
background = callback.get("background")
14401440
if not background:
14411441
continue
14421442
if "cancel_inputs" in background:

0 commit comments

Comments
 (0)