Skip to content

Commit

Permalink
fix(Bundles): memory limit [YTFRONT-4170]
Browse files Browse the repository at this point in the history
  • Loading branch information
SimbiozizV committed May 23, 2024
1 parent 43f5034 commit 4be139c
Showing 1 changed file with 29 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ export function fetchTabletCellBundleEditor(bundleName: string): TabletCellBundl
},
];

requests.push({
command: 'get',
parameters: {
path: '//sys/bundle_controller/controller/zones/zone_default/@tablet_node_sizes/nextgen/default_config/memory_limits/reserved',
},
});

if (toEdit.enable_bundle_controller) {
requests.push({
command: 'get',
Expand All @@ -73,7 +80,7 @@ export function fetchTabletCellBundleEditor(bundleName: string): TabletCellBundl
.then((results) => {
const bundleControllerIsUnavailable =
toEdit.enable_bundle_controller &&
results[1]?.error?.code === yt.codes.NODE_DOES_NOT_EXIST;
results[2]?.error?.code === yt.codes.NODE_DOES_NOT_EXIST;
const error = getBatchError(
bundleControllerIsUnavailable ? [results[0]] : results,
'Failed to get bundle edit data',
Expand All @@ -91,13 +98,31 @@ export function fetchTabletCellBundleEditor(bundleName: string): TabletCellBundl
},
)
.then((results) => {
const [{output: data}, {output: bundleControllerData} = {output: undefined}] =
results as BatchResults<[unknown, OrchidBundlesData]>;
const [
{output: data},
{output: defaultReservedMemoryLimit},
{output: bundleControllerData} = {output: undefined},
] = results as BatchResults<[unknown, number, OrchidBundlesData]>;

let bundleData = toEdit;

if (!toEdit.bundle_controller_target_config.memory_limits.reserved) {
bundleData = {
...toEdit,
bundle_controller_target_config: {
...toEdit.bundle_controller_target_config,
memory_limits: {
...toEdit.bundle_controller_target_config.memory_limits,
reserved: defaultReservedMemoryLimit,
},
},
};
}

dispatch({
type: TABLETS_BUNDLES_EDITOR_LOAD_SUCCESS,
data: {
bundleData: toEdit,
bundleData,
data,
bundleControllerData,
},
Expand Down

0 comments on commit 4be139c

Please sign in to comment.