Skip to content

Commit bc8a5f8

Browse files
PetrdontoneЯснецов Петр Андреевич
andauthored
fix: Corrected the logic for sending devices to the hub + correct text when sending iOS devices (#1970)
Co-authored-by: Яснецов Петр Андреевич <iasnetsov_p@goldapple.ru>
1 parent 0ef71bc commit bc8a5f8

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/data-service/node-service.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Node } from '@prisma/client';
2-
import { IPluginArgs } from '../interfaces/IPluginArgs';
32
import os from 'os';
43
import { prisma } from '../prisma';
54
import { JWT_SECRET } from '../auth/middleware/auth.middleware';

src/device-managers/NodeDevices.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import log from '../logger';
33
import { DeviceUpdate } from '../types/DeviceUpdate';
44
import { IDeviceFilterOptions } from '../interfaces/IDeviceFilterOptions';
55
import { IDevice } from '../interfaces/IDevice';
6-
import { ATDRepository } from '../data-service/db';
76

87
export default class NodeDevices {
98
private host: string;
@@ -34,7 +33,10 @@ export default class NodeDevices {
3433
async postDevicesToHub(devices: IDevice[] | DeviceUpdate[], arg: string) {
3534
// DeviceWithPath -> new device
3635
// DeviceUpdate -> removed device
37-
log.info(`Updating remote android devices ${this.host}/device-farm/api/register`);
36+
const [firstDevice] = devices;
37+
log.info(
38+
`Updating remote ${firstDevice.platform} devices ${this.host}/device-farm/api/register`,
39+
);
3840
try {
3941
const status = (
4042
await axios.post(`${this.host}/device-farm/api/register`, devices, {

src/device-utils.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* eslint-disable no-prototype-builtins */
22
import waitUntil from 'async-wait-until';
33
import fs from 'fs';
4-
import getPort from 'get-port';
54
import _ from 'lodash';
65
import { LocalStorage } from 'node-persist';
76
import { Container } from 'typedi';
@@ -92,7 +91,11 @@ export function isDeviceConfigPathAbsolute(path: string): boolean | undefined {
9291
/**
9392
* For given capability, wait untill a free device is available from the database
9493
* and update the capability json with required device informations
94+
* @param requestId
9595
* @param capability
96+
* @param deviceTimeOutMs
97+
* @param deviceQueryIntervalMs
98+
* @param pluginArgs
9699
* @returns
97100
*/
98101
export async function allocateDeviceForSession(
@@ -429,7 +432,7 @@ export async function refreshSimulatorState(pluginArgs: IPluginArgs, hostPort: n
429432
timer = setInterval(async () => {
430433
const simulators = await new IOSDeviceManager(pluginArgs, hostPort, uuidv4()).getSimulators();
431434
await setSimulatorState(simulators);
432-
}, 10000);
435+
}, pluginArgs.sendNodeDevicesToHubIntervalMs);
433436
}
434437

435438
export async function setupCronCheckStaleDevices(intervalMs: number, currentHost: string) {

0 commit comments

Comments
 (0)