Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add google watch disabling #533

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ jobs:
--service_account /service_account.json \
--share_email [email protected] \
--workdir /data \
server 3000
server 3000 \
--disable_google_watch

remove:
if: github.event.pull_request.head.ref != 'develop' && !contains( github.event.pull_request.labels.*.name, 'deploy-pr')
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions src/cli/wikigdrive-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ export class MainService {
process.exit(1);
}

const changesContainer = new WatchChangesContainer({ name: 'watch_changes', share_email: this.params.share_email });
await changesContainer.mount(await this.mainFileService);
await this.containerEngine.registerContainer(changesContainer);
await changesContainer.run();
if (!this.params.disable_google_watch) {
const changesContainer = new WatchChangesContainer({ name: 'watch_changes', share_email: this.params.share_email });
await changesContainer.mount(await this.mainFileService);
await this.containerEngine.registerContainer(changesContainer);
await changesContainer.run();
}

const port = parseInt(this.params.args[1]) || 3000;
const serverContainer = new ServerContainer({ name: 'server', share_email: this.params.share_email }, port);
Expand Down Expand Up @@ -159,7 +161,8 @@ async function main() {

service_account: argv['service_account'] || null,
share_email: argv['share_email'] || process.env.SHARE_EMAIL || null,
server_port: +argv['server_port']
server_port: +argv['server_port'],
disable_google_watch: !!argv['disable_google_watch']
};

const mainService = new MainService(params);
Expand Down
16 changes: 9 additions & 7 deletions src/containers/server/SocketManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,15 @@ export class SocketManager {
}));


const watchChangesContainer = <WatchChangesContainer>this.engine.getContainer('watch_changes');
const changes = await watchChangesContainer.getChanges(driveId);
const filteredChanges = await this.getFilteredChanges(driveId, changes);
ws.send(JSON.stringify({
cmd: 'changes:changed',
payload: filteredChanges
}));
if (this.engine.hasContainer('watch_changes')) {
const watchChangesContainer = <WatchChangesContainer>this.engine.getContainer('watch_changes');
const changes = await watchChangesContainer.getChanges(driveId);
const filteredChanges = await this.getFilteredChanges(driveId, changes);
ws.send(JSON.stringify({
cmd: 'changes:changed',
payload: filteredChanges
}));
}

ws.on('close', () => {
this.socketsMap[driveId].delete(ws);
Expand Down
1 change: 1 addition & 0 deletions src/model/CliParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ export interface CliParams {
service_account?: string;
server_port?: number;
share_email?: string;
disable_google_watch: boolean;
}
Loading