Skip to content

Commit

Permalink
fix: absurd deploy erros have been fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoehabb committed Dec 8, 2024
1 parent 29b5947 commit 2d4dacf
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
4 changes: 2 additions & 2 deletions apps/nova/src/pages/Call.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const Call: React.FC = () => {
const ctype = useMemo(() => {
if (callType != "lesson" && callType != "interview") return null;
return callType;
}, [id]);
}, [callType]);

const callRoom = useFindCallRoomById(!isGhost ? callId : null);

Expand Down Expand Up @@ -166,7 +166,7 @@ const Call: React.FC = () => {
)
);

// console.log({ ghostStreams });
useEffect(() => console.log({ ghostStreams }), [ghostStreams]);

const callViewProps: CallViewProps = useMemo(
() => ({
Expand Down
8 changes: 4 additions & 4 deletions packages/headless/src/calls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1044,16 +1044,16 @@ export function useCallMembers(callId: number | null, callType: ICall.Type | nul
const [members, setMembers] = useState<number[]>([]);
useEffect(() => {
if (data) setMembers(data)
}, [isPending])
}, [data, isPending])

// define WSS events callbacks
const onMemberJoinWssCallback: CallEventsCallback = useCallback(payload => {
setMembers(prev => [...prev, payload.userId]);
}, [callId])
}, [])

const onMemberLeaveWssCallback: CallEventsCallback = useCallback(payload => {
setMembers(prev => prev.filter(id => id !== payload.userId));
}, [callId])
}, [])

// define react callbacks
const joinCall = useCallback(() => {
Expand All @@ -1079,7 +1079,7 @@ export function useCallMembers(callId: number | null, callType: ICall.Type | nul
socket.off(Wss.ServerEvent.MemberLeftCall);
leaveCall();
}
}, [callId, socket])
}, [callId, socket, joinCall, leaveCall, onMemberLeaveWssCallback, onMemberJoinWssCallback])

return members;
}
4 changes: 4 additions & 0 deletions packages/models/src/cache/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,8 @@ export class Cache {
async connect() {
await this.client.connect();
}

async disconnect() {
await this.client.quit();
}
}
9 changes: 9 additions & 0 deletions services/server/tests/api/call.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ import { expect } from "chai";
import { cache } from "@/lib/cache";

describe("/api/v1/call", () => {

beforeAll(async () => {
await cache.connect();
});

afterAll(async () => {
await cache.disconnect();
});

beforeEach(async () => {
await flush();
await cache.flush();
Expand Down
9 changes: 9 additions & 0 deletions services/server/tests/wss/call.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,17 @@ describe("calls test suite", () => {
let tutorApi: Api;
let studentApi: Api;

beforeAll(async () => {
await cache.connect();
});

afterAll(async () => {
await cache.disconnect();
});

beforeEach(async () => {
await flush();
await cache.flush();

tutorApi = await Api.forTutor();
tutor = await tutorApi.findCurrentUser();
Expand Down

0 comments on commit 2d4dacf

Please sign in to comment.