refactor: removed redis + new scheduler engine
This commit is contained in:
@@ -12,9 +12,9 @@ module.exports = {
|
||||
},
|
||||
LocalizationQuery: {
|
||||
async locales(obj, args, context, info) {
|
||||
let remoteLocales = await WIKI.redis.get('locales')
|
||||
let remoteLocales = await WIKI.cache.get('locales')
|
||||
let localLocales = await WIKI.models.locales.query().select('code', 'isRTL', 'name', 'nativeName', 'createdAt', 'updatedAt')
|
||||
remoteLocales = (remoteLocales) ? JSON.parse(remoteLocales) : localLocales
|
||||
remoteLocales = (remoteLocales) ? remoteLocales : localLocales
|
||||
return _.map(remoteLocales, rl => {
|
||||
let isInstalled = _.some(localLocales, ['code', rl.code])
|
||||
return {
|
||||
@@ -39,12 +39,11 @@ module.exports = {
|
||||
LocalizationMutation: {
|
||||
async downloadLocale(obj, args, context) {
|
||||
try {
|
||||
const job = await WIKI.queue.job.fetchGraphLocale.add({
|
||||
locale: args.locale
|
||||
}, {
|
||||
timeout: 30000
|
||||
})
|
||||
await job.finished()
|
||||
const job = await WIKI.scheduler.registerJob({
|
||||
name: 'fetch-graph-locale',
|
||||
immediate: true
|
||||
}, args.locale)
|
||||
await job.finished
|
||||
return {
|
||||
responseResult: graphHelper.generateSuccess('Locale downloaded successfully')
|
||||
}
|
||||
|
@@ -98,18 +98,6 @@ module.exports = {
|
||||
nodeVersion() {
|
||||
return process.version.substr(1)
|
||||
},
|
||||
redisVersion() {
|
||||
return WIKI.redis.serverInfo.redis_version
|
||||
},
|
||||
redisUsedRAM() {
|
||||
return WIKI.redis.serverInfo.used_memory_human
|
||||
},
|
||||
redisTotalRAM() {
|
||||
return _.get(WIKI.redis.serverInfo, 'total_system_memory_human', 'N/A')
|
||||
},
|
||||
redisHost() {
|
||||
return WIKI.redis.options.host
|
||||
},
|
||||
async groupsTotal() {
|
||||
const total = await WIKI.models.groups.query().count('* as total').first().pluck('total')
|
||||
return _.toSafeInteger(total)
|
||||
|
@@ -38,10 +38,6 @@ type SystemInfo {
|
||||
pagesTotal: Int @auth(requires: ["manage:system", "manage:navigation", "manage:pages", "delete:pages"])
|
||||
platform: String @auth(requires: ["manage:system"])
|
||||
ramTotal: String @auth(requires: ["manage:system"])
|
||||
redisHost: String @auth(requires: ["manage:system"])
|
||||
redisTotalRAM: String @auth(requires: ["manage:system"])
|
||||
redisUsedRAM: String @auth(requires: ["manage:system"])
|
||||
redisVersion: String @auth(requires: ["manage:system"])
|
||||
usersTotal: Int @auth(requires: ["manage:system", "manage:navigation", "manage:groups", "write:groups", "manage:users", "write:users"])
|
||||
workingDirectory: String @auth(requires: ["manage:system"])
|
||||
}
|
||||
|
Reference in New Issue
Block a user