Skip to content

Commit

Permalink
generalize the waiting condition
Browse files Browse the repository at this point in the history
  • Loading branch information
anshamray committed Sep 17, 2024
1 parent 4195c47 commit 9c5652b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions support/api/objectApi.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getCurrentClient } from "../helpers/proxy";
import { store } from "../helpers/store";
import { isVersion035, makeGrpcCall } from "../helpers/utils";
import { isVersion035OrMore, makeGrpcCall } from "../helpers/utils";
import {
Rpc_Object_Open_Request,
Rpc_Object_Create_Request,
Expand Down Expand Up @@ -65,8 +65,10 @@ export async function callOpenObject(objectNumber: number): Promise<void> {
);

const client = getCurrentClient();
//wait for 60 seconds
if (store.currentServerVersion && isVersion035(store.currentServerVersion)) {
if (
store.currentServerVersion &&
isVersion035OrMore(store.currentServerVersion)
) {
console.log(
"Heart verison 35, Waiting for 15 seconds before objectOpening..."
);
Expand Down
4 changes: 2 additions & 2 deletions support/helpers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function isVersion034OrLess(version: string): boolean {
* @param version - The server version string (e.g., "v0.33.2" or "v0.34.7").
* @returns {boolean} - Returns true if the server version is 0.34 or less, false otherwise.
*/
export function isVersion035(version: string): boolean {
export function isVersion035OrMore(version: string): boolean {
// Remove the 'v' prefix if it exists
if (version.startsWith("v")) {
version = version.slice(1);
Expand All @@ -40,7 +40,7 @@ export function isVersion035(version: string): boolean {
const [, minor] = version.split(".").map(Number);

// Check if the minor version is 35
if (minor == 35) {
if (minor >= 35) {
return true;
}

Expand Down

0 comments on commit 9c5652b

Please sign in to comment.