Remove kue migration
authorChocobozzz <me@florianbigard.com>
Mon, 30 Jul 2018 14:34:47 +0000 (16:34 +0200)
committerChocobozzz <me@florianbigard.com>
Mon, 30 Jul 2018 14:34:47 +0000 (16:34 +0200)
server/controllers/activitypub/inbox.ts
server/initializers/migrations/0230-kue-to-bull.ts [deleted file]

index 73fbd94aa3fd3a27a822914bd2ea366783f0f113..a106df717f0847598a8d8d0d1a34609b97fcda49 100644 (file)
@@ -36,8 +36,6 @@ async function inboxController (req: express.Request, res: express.Response, nex
   const rootActivity: RootActivity = req.body
   let activities: Activity[] = []
 
-  console.log(rootActivity)
-
   if ([ 'Collection', 'CollectionPage' ].indexOf(rootActivity.type) !== -1) {
     activities = (rootActivity as ActivityPubCollection).items
   } else if ([ 'OrderedCollection', 'OrderedCollectionPage' ].indexOf(rootActivity.type) !== -1) {
diff --git a/server/initializers/migrations/0230-kue-to-bull.ts b/server/initializers/migrations/0230-kue-to-bull.ts
deleted file mode 100644 (file)
index 5f4d88b..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-import * as Sequelize from 'sequelize'
-import { createClient } from 'redis'
-import { CONFIG } from '../constants'
-import { JobQueue } from '../../lib/job-queue'
-import { Redis } from '../../lib/redis'
-import { initDatabaseModels } from '../database'
-
-async function up (utils: {
-  transaction: Sequelize.Transaction
-  queryInterface: Sequelize.QueryInterface
-  sequelize: Sequelize.Sequelize
-}): Promise<any> {
-  await initDatabaseModels(false)
-
-  return new Promise((res, rej) => {
-    const client = createClient(Redis.getRedisClient())
-
-    const jobsPrefix = 'q-' + CONFIG.WEBSERVER.HOST
-
-    client.sort(jobsPrefix + ':jobs:inactive', 'by', 'alpha', 'ASC', (err, jobStrings) => {
-      if (err) return rej(err)
-
-      const jobPromises = jobStrings
-        .map(s => s.split('|'))
-        .map(([ , jobId ]) => {
-          return new Promise((res, rej) => {
-            client.hgetall(jobsPrefix + ':job:' + jobId, (err, job) => {
-              if (err) return rej(err)
-
-              try {
-                const parsedData = JSON.parse(job.data)
-
-                return res({ type: job.type, payload: parsedData })
-              } catch (err) {
-                console.error('Cannot parse data %s.', job.data)
-                return res(undefined)
-              }
-            })
-          })
-        })
-
-      JobQueue.Instance.init()
-              .then(() => Promise.all(jobPromises))
-              .then((jobs: any) => {
-                const createJobPromises = jobs
-                  .filter(job => job !== null)
-                  .map(job => JobQueue.Instance.createJob(job))
-
-                return Promise.all(createJobPromises)
-              })
-              .then(() => res())
-    })
-  })
-}
-
-function down (options) {
-  throw new Error('Not implemented.')
-}
-
-export { up, down }