fix: slow get recipe memo
- fix: cannot adb command from blocking suspicious cmd - change: logging to logtape lib - change: adb payload handler format to send payload size as header for exact match payload Signed-off-by: pakintada@gmail.com <Pakin>
This commit is contained in:
parent
aa6414b1cc
commit
3cda8aa60b
12 changed files with 494 additions and 174 deletions
|
|
@ -347,8 +347,73 @@ async function handleAdbPayload(raw_payload: string) {
|
|||
|
||||
recipeFromMachine.set(recipeRawFromMachine);
|
||||
} else {
|
||||
if (sub_type == null) {
|
||||
try {
|
||||
let big_recipe = JSON.parse(JSON.stringify(payload.payload));
|
||||
logger.info(`get large recipe keys: ${Object.keys(big_recipe)}`);
|
||||
|
||||
let recipes = JSON.parse(big_recipe?.recipes);
|
||||
let materials = JSON.parse(big_recipe?.materials);
|
||||
let toppings = JSON.parse(big_recipe?.toppings);
|
||||
|
||||
let updated = {
|
||||
Recipe01: recipes,
|
||||
MaterialSetting: materials,
|
||||
Topping: toppings
|
||||
};
|
||||
|
||||
recipeFromMachine.set(updated);
|
||||
|
||||
// =====================================
|
||||
//
|
||||
// Build Overview
|
||||
//
|
||||
|
||||
let queries = [];
|
||||
for (let rp of recipes) {
|
||||
queries.push({
|
||||
productCode: rp.productCode ?? '<not set>',
|
||||
name: rp.name ? rp.name : (rp.otherName ?? '<not set>'),
|
||||
description: rp.description
|
||||
? rp.description
|
||||
: (rp.otherDescription ?? '<not set>'),
|
||||
tags: buildTags(rp),
|
||||
status: getMenuStatus(rp.MenuStatus)
|
||||
});
|
||||
}
|
||||
|
||||
let cached_query_from_machine = get(recipeFromMachineQuery);
|
||||
|
||||
cached_query_from_machine = {
|
||||
...cached_query_from_machine,
|
||||
recipe: queries
|
||||
};
|
||||
|
||||
recipeFromMachineQuery.set(cached_query_from_machine);
|
||||
|
||||
// =====================================
|
||||
//
|
||||
// Send finish signal
|
||||
|
||||
GlobalEventBus.emitUntilConsumed('recipe-event', {
|
||||
type: 'load-recipe',
|
||||
status: 'end',
|
||||
reload: true
|
||||
});
|
||||
} catch (e) {
|
||||
logger.error('some promise failed: ', e);
|
||||
|
||||
GlobalEventBus.emitUntilConsumed('recipe-event', {
|
||||
type: 'load-recipe-fail',
|
||||
status: 'end',
|
||||
reload: true
|
||||
});
|
||||
}
|
||||
} else {
|
||||
logger.info(`unhandled sub type: %${sub_type}%`);
|
||||
}
|
||||
|
||||
// unhandled sub type
|
||||
logger.info('unhandled sub type', payload);
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue