Skip to content

Commit

Permalink
Remove queue worker initialization (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
XbNz authored Dec 26, 2024
1 parent ecbf1b8 commit c0f5bf2
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 56 deletions.
8 changes: 1 addition & 7 deletions resources/js/electron-plugin/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { app } from "electron";
import { autoUpdater } from "electron-updater";
import state from "./server/state";
import { electronApp, optimizer } from "@electron-toolkit/utils";
import { retrieveNativePHPConfig, retrievePhpIniSettings, runScheduler, startAPI, startPhpApp, startQueue, } from "./server";
import { retrieveNativePHPConfig, retrievePhpIniSettings, runScheduler, startAPI, startPhpApp, } from "./server";
import { notifyLaravel } from "./server/utils";
import { resolve } from "path";
import { stopAllProcesses } from "./server/api/childProcess";
Expand Down Expand Up @@ -75,7 +75,6 @@ class NativePHP {
yield this.startElectronApi();
state.phpIni = yield this.loadPhpIni();
yield this.startPhpApp();
yield this.startQueueWorker();
this.startScheduler();
yield notifyLaravel("booted");
});
Expand Down Expand Up @@ -148,11 +147,6 @@ class NativePHP {
this.processes.push(yield startPhpApp());
});
}
startQueueWorker() {
return __awaiter(this, void 0, void 0, function* () {
this.processes.push(yield startQueue());
});
}
startScheduler() {
const now = new Date();
const delay = (60 - now.getSeconds()) * 1000 + (1000 - now.getMilliseconds());
Expand Down
10 changes: 1 addition & 9 deletions resources/js/electron-plugin/dist/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
import startAPIServer from "./api";
import { retrieveNativePHPConfig, retrievePhpIniSettings, serveApp, startQueueWorker, startScheduler, } from "./php";
import { retrieveNativePHPConfig, retrievePhpIniSettings, serveApp, startScheduler, } from "./php";
import { appendCookie } from "./utils";
import state from "./state";
export function startPhpApp() {
Expand All @@ -19,14 +19,6 @@ export function startPhpApp() {
return result.process;
});
}
export function startQueue() {
if (!process.env.NATIVE_PHP_SKIP_QUEUE) {
return startQueueWorker(state.randomSecret, state.electronApiPort, state.phpIni);
}
else {
return undefined;
}
}
export function runScheduler() {
startScheduler(state.randomSecret, state.electronApiPort, state.phpIni);
}
Expand Down
10 changes: 1 addition & 9 deletions resources/js/electron-plugin/dist/server/php.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,6 @@ function ensureAppFoldersAreAvailable() {
writeFileSync(databaseFile, '');
}
}
function startQueueWorker(secret, apiPort, phpIniSettings = {}) {
const env = getDefaultEnvironmentVariables(secret, apiPort);
const phpOptions = {
cwd: appPath,
env
};
return callPhp(['artisan', 'queue:work', '-q'], phpOptions, phpIniSettings);
}
function startScheduler(secret, apiPort, phpIniSettings = {}) {
const env = getDefaultEnvironmentVariables(secret, apiPort);
const phpOptions = {
Expand Down Expand Up @@ -214,4 +206,4 @@ function serveApp(secret, apiPort, phpIniSettings) {
});
}));
}
export { startQueueWorker, startScheduler, serveApp, getAppPath, retrieveNativePHPConfig, retrievePhpIniSettings, getDefaultEnvironmentVariables, getDefaultPhpIniSettings };
export { startScheduler, serveApp, getAppPath, retrieveNativePHPConfig, retrievePhpIniSettings, getDefaultEnvironmentVariables, getDefaultPhpIniSettings };
6 changes: 0 additions & 6 deletions resources/js/electron-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
runScheduler,
startAPI,
startPhpApp,
startQueue,
} from "./server";
import { notifyLaravel } from "./server/utils";
import { resolve } from "path";
Expand Down Expand Up @@ -101,7 +100,6 @@ class NativePHP {
state.phpIni = await this.loadPhpIni();

await this.startPhpApp();
await this.startQueueWorker();
this.startScheduler();

await notifyLaravel("booted");
Expand Down Expand Up @@ -184,10 +182,6 @@ class NativePHP {
this.processes.push(await startPhpApp());
}

private async startQueueWorker() {
this.processes.push(await startQueue());
}

private startScheduler() {
const now = new Date();
const delay =
Expand Down
13 changes: 0 additions & 13 deletions resources/js/electron-plugin/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
retrieveNativePHPConfig,
retrievePhpIniSettings,
serveApp,
startQueueWorker,
startScheduler,
} from "./php";
import { appendCookie } from "./utils";
Expand All @@ -23,18 +22,6 @@ export async function startPhpApp() {
return result.process;
}

export function startQueue() {
if (!process.env.NATIVE_PHP_SKIP_QUEUE) {
return startQueueWorker(
state.randomSecret,
state.electronApiPort,
state.phpIni
);
} else {
return undefined;
}
}

export function runScheduler() {
startScheduler(state.randomSecret, state.electronApiPort, state.phpIni);
}
Expand Down
13 changes: 1 addition & 12 deletions resources/js/electron-plugin/src/server/php.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,6 @@ function ensureAppFoldersAreAvailable() {
}
}

function startQueueWorker(secret, apiPort, phpIniSettings = {}) {
const env = getDefaultEnvironmentVariables(secret, apiPort);

const phpOptions = {
cwd: appPath,
env
};

return callPhp(['artisan', 'queue:work', '-q'], phpOptions, phpIniSettings);
}

function startScheduler(secret, apiPort, phpIniSettings = {}) {
const env = getDefaultEnvironmentVariables(secret, apiPort);

Expand Down Expand Up @@ -262,4 +251,4 @@ function serveApp(secret, apiPort, phpIniSettings): Promise<ProcessResult> {
})
}

export {startQueueWorker, startScheduler, serveApp, getAppPath, retrieveNativePHPConfig, retrievePhpIniSettings, getDefaultEnvironmentVariables, getDefaultPhpIniSettings}
export {startScheduler, serveApp, getAppPath, retrieveNativePHPConfig, retrievePhpIniSettings, getDefaultEnvironmentVariables, getDefaultPhpIniSettings}

0 comments on commit c0f5bf2

Please sign in to comment.