-
Notifications
You must be signed in to change notification settings - Fork 181
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
gergo/previews #3765
base: main
Are you sure you want to change the base?
gergo/previews #3765
Conversation
@@ -125,4 +125,4 @@ RUN apt-get update && \ | |||
# Run everything after as non-privileged user. | |||
USER pptruser | |||
|
|||
ENTRYPOINT [ "tini", "--", "node", "--loader=./dist/src/aliasLoader.js", "bin/www.js" ] | |||
CMD [ "tini", "--", "node", "dist/main" ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're changing this, and to be pedantic, entrypoint should be the binary being executed and cmd the arguments to that statement. So:
ENTRYPOINT [ "tini", "--", "node"]
CMD ["dist/main"]
And is there a reason for using dist/main
pattern over the bin/www.js
pattern?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the _bak
directory? Is it a backup to be removed?
@@ -1,4 +1,4 @@ | |||
import type { Preview } from '@/domain/domain.js' | |||
import type { Preview } from '../domain/domain.js' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we retain the alias pattern please? i.e. @/domain/domain.js
would be preferable.
@@ -12,7 +12,7 @@ import { | |||
notifyUpdateFactory, | |||
updatePreviewMetadataFactory | |||
} from '@/repositories/objectPreview.js' | |||
import { insertPreviewFactory } from '@/repositories/previews.js' | |||
import { insertPreviewFactory } from '../repositories/previews.js' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, the alias pattern should be used.
import type { InsertPreview } from '@/repositories/previews.js' | ||
import type { GeneratePreview } from '../clients/previewService.js' | ||
import type { Angle, ObjectIdentifier, PreviewId } from '../domain/domain.js' | ||
import type { InsertPreview } from '../repositories/previews.js' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alias pattern should be used. Is there an eslint rule missing?
} | ||
} | ||
} | ||
const previewRequestQueue = new Bull('preview-service-jobs', opts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The queue name should be configurable.
|
||
const opts = { | ||
// redisOpts here will contain at least a property of connectionName which will identify the queue based on its name | ||
createClient: function (type: string, redisOpts: RedisOptions) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case of one worker for multiple deployments, how do we expect the infrastructure to be configured?
A new Redis cluster with one preview service queue? And all deployments publish to the cluster & queue.
Or the preview-service connects to all the existing Redis clusters, and reads each of their queues?
|
||
if (isInitial) { | ||
listenFor('preview_generation_update', messageProcessor) | ||
// listenFor('preview_generation_update', messageProcessor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should remove all commented out code. ☠️
|
||
app.options('/preview/:streamId/:angle?', cors()) | ||
app.get('/preview/:streamId/:angle?', cors(), async (req, res) => { | ||
const projectDb = await getProjectDbClient({ projectId: req.params.streamId }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we feel about refactoring these to named functions (possibly exported from the services directory?), so they can be called from other parts of the server codebase without an http call (or tested without starting an Express server)?
@@ -85,6 +86,7 @@ | |||
"graphql-subscriptions": "^2.0.0", | |||
"graphql-tag": "^2.12.6", | |||
"ioredis": "^5.2.2", | |||
"join-images": "^1.1.5", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the server should be responsible for joining images.
|
Description & motivation
Limitations with the existing preview service:
This PR aims to resolve these shortcomings
Changes:
To-do before merge:
Screenshots:
Validation of changes:
Checklist:
References