Skip to content

Commit

Permalink
refactor: Swap parameters in getSegmentData()
Browse files Browse the repository at this point in the history
  • Loading branch information
DimaDemchenko committed Sep 24, 2024
1 parent e93de6b commit 6be67bc
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/p2p-media-loader-core/src/hybrid-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ export class HybridLoader {

if (hasSegment) {
const data = await this.segmentStorage.getSegmentData(
swarmId,
streamSwarmId,
segment.externalId,
swarmId,
);
if (data) {
const { queueDownloadRatio } = this.generateQueue();
Expand Down
4 changes: 2 additions & 2 deletions packages/p2p-media-loader-core/src/p2p/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ export class P2PLoader {
const streamSwarmId = StreamUtils.getStreamSwarmId(swarmId, this.stream);

const segmentData = await this.segmentStorage.getSegmentData(
streamSwarmId,
segmentExternalId,
swarmId,
streamSwarmId,
segment.externalId,
);
if (!segmentData) {
peer.sendSegmentAbsentCommand(segmentExternalId, requestId);
Expand Down
4 changes: 2 additions & 2 deletions packages/p2p-media-loader-core/src/segment-storage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ export interface SegmentStorage {

/**
* Returns segment data
* @param swarmId - Swarm identifier
* @param streamId - Stream identifier
* @param segmentId - Segment identifier
* @param swarmId - Swarm identifier
*/
getSegmentData(
swarmId: string,
streamId: string,
segmentId: number,
swarmId: string,
): Promise<ArrayBuffer | undefined>;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export class SegmentMemoryStorage implements SegmentStorage {
}

// eslint-disable-next-line @typescript-eslint/require-await
async getSegmentData(streamId: string, segmentId: number, _swarmId: string) {
async getSegmentData(_swarmId: string, streamId: string, segmentId: number) {
const segmentStorageId = getStorageItemId(streamId, segmentId);
const dataItem = this.cache.get(segmentStorageId);

Expand Down

0 comments on commit 6be67bc

Please sign in to comment.