Skip to content

Commit

Permalink
Initial refactor to jobs-only lf-sync
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Balmos <[email protected]>
  • Loading branch information
abalmos committed Oct 17, 2024
1 parent 9ceeed0 commit 3aa048c
Show file tree
Hide file tree
Showing 9 changed files with 420 additions and 1,332 deletions.
925 changes: 0 additions & 925 deletions .yarn/releases/yarn-4.5.0.cjs

This file was deleted.

1 change: 1 addition & 0 deletions service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"@types/node": "^22.7.5",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@yarnpkg/sdks": "^3.2.0",
"ava": "6.1.3",
"c8": "^10.1.2",
"eslint": "^8.57.1",
Expand Down
21 changes: 3 additions & 18 deletions service/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const { config } = await libConfig({
},
service: {
poller: {
'poll-rate': {
pollRate: {
doc: 'Polling rate in seconds',
format: Number,
default: 180,
Expand All @@ -41,7 +41,7 @@ export const { config } = await libConfig({
env: 'SERVICE_POLLER_FORCE_ARCHIVE_AGE',
arg: 'service-poller-force-archive-age',
},
'closer': {
closer: {
doc: 'The closer to use when processing tickets.',
format: String,
default: 'none',
Expand All @@ -63,23 +63,8 @@ export const { config } = await libConfig({
env: 'SERVICE_ARCHIVE_TIMEOUT',
arg: 'service-archive-timeout',
},
},
lfCloser: {
name: {
doc: 'Service name of Laserfiche closer service',
default: 'lfCloser',
env: 'SERVICE_LFCLOSER_NAME',
arg: 'service-lfcloser-name',
},
timeout: {
doc: 'Time limit on waiting for lf-sync to file ticket',
format: Number,
default: 7 * 24 * 60 * 60 * 1000,
env: 'SERVICE_LFCLOSER_TIMEOUT',
arg: 'service-lfcloser-timeout',
},
pathFieldId: {
doc: 'Zendesk custom field ID for"Laserfiche Path"',
doc: 'Zendesk custom field ID for "Laserfiche Path"',
format: Number,
default: -1,
env: 'SERVICE_LFCLOSER_PATH_FIELD_ID',
Expand Down
14 changes: 5 additions & 9 deletions service/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const { token, domain } = config.get('oada');
export async function run() {
let oada;
let service;
let poller;
// let poller;

try {
log.info({}, 'Connecting to Trellis');
Expand All @@ -72,25 +72,21 @@ export async function run() {
archiveTicketService,
);

log.info({}, 'Initialize `lfCloser` service');
service.on(
config.get('service.lfCloser.name'),
config.get('service.lfCloser.timeout'),
lfCloserService,
);

log.info({}, 'Start @oada/jobs based services');
await service.start();

log.info({}, 'Start polling ZenDesk polling service');
poller = pollerService(oada);
// FIXME: Uncomment
// poller = pollerService(oada);
//
} catch (error) {
log.fatal({ error }, `Failed to start service: ${error}`);
// Try to stop poller, if needed
/*
if (poller) {
poller.stop();
}
*/

// Try to stop @oada/jobs services, if needed
if (service) {
Expand Down
Loading

0 comments on commit 3aa048c

Please sign in to comment.