Skip to content

Commit 49e4ec1

Browse files
authored
bump nano (#599)
This required a change to the way the express app follows the changes feed on a course and applies its audio processing. If problems are observed on that front, we'll want to look back here.
2 parents a8c2c5f + cd0a85a commit 49e4ec1

File tree

3 files changed

+76
-384
lines changed

3 files changed

+76
-384
lines changed

packages/express/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"ffmpeg-static": "^5.2.0",
3030
"hashids": "^2.3.0",
3131
"morgan": "^1.10.0",
32-
"nano": "^8.0.0",
32+
"nano": "^ 9.0.5",
3333
"pouchdb": "8.0.1",
3434
"winston": "^3.17.0",
3535
"winston-daily-rotate-file": "^5.0.0"

packages/express/src/attachment-preprocessing/index.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,24 @@ export function postProcessCourse(courseID: string): void {
3434

3535
const crsString = `coursedb-${courseID}`;
3636

37-
CouchDB.db.follow(
38-
crsString,
39-
{
40-
feed: 'continuous',
41-
db: crsString,
42-
include_docs: false,
43-
},
44-
filterFactory(courseID)
45-
);
37+
// Get database instance
38+
const db = CouchDB.use(crsString);
39+
40+
const courseFilter = filterFactory(courseID);
41+
42+
db.changesReader
43+
.start({
44+
// feed: 'continuous',
45+
includeDocs: false,
46+
})
47+
.on('change', (change: nano.DatabaseChangesResultItem) => {
48+
courseFilter(change).catch((e) => {
49+
logger.error(`Error in CourseFilter for ${courseID}: ${e}`);
50+
});
51+
})
52+
.on('error', (err: Error) => {
53+
logger.error(`Error in changes feed for ${crsString}: ${err}`);
54+
});
4655
} catch (e) {
4756
logger.error(`Error in postProcessCourse: ${e}`);
4857
}
@@ -77,7 +86,6 @@ function filterFactory(courseID: string) {
7786
const courseDatabase = CouchDB.use<DocForProcessing>(`coursedb-${courseID}`);
7887

7988
return async function filterChanges(
80-
error: any,
8189
changeItem: nano.DatabaseChangesResultItem
8290
) {
8391
try {

0 commit comments

Comments
 (0)