chore: clean
All checks were successful
/ build (map[dockerfile:./services/app/Dockerfile name:app]) (push) Successful in 1m56s
/ build (map[dockerfile:./services/web/Dockerfile name:web]) (push) Successful in 2m26s
/ build (map[dockerfile:./services/api/Dockerfile name:api]) (push) Successful in 2m7s
/ build (map[dockerfile:./services/files/Dockerfile name:files]) (push) Successful in 1m47s
/ build (map[dockerfile:./services/tasks/Dockerfile name:tasks]) (push) Successful in 2m12s
/ build (map[dockerfile:./services/hasura/Dockerfile name:hasura]) (push) Successful in 2m27s
/ build (map[dockerfile:./services/watchers/Dockerfile name:watchers]) (push) Successful in 2m35s
/ deploy (push) Successful in 16s
All checks were successful
/ build (map[dockerfile:./services/app/Dockerfile name:app]) (push) Successful in 1m56s
/ build (map[dockerfile:./services/web/Dockerfile name:web]) (push) Successful in 2m26s
/ build (map[dockerfile:./services/api/Dockerfile name:api]) (push) Successful in 2m7s
/ build (map[dockerfile:./services/files/Dockerfile name:files]) (push) Successful in 1m47s
/ build (map[dockerfile:./services/tasks/Dockerfile name:tasks]) (push) Successful in 2m12s
/ build (map[dockerfile:./services/hasura/Dockerfile name:hasura]) (push) Successful in 2m27s
/ build (map[dockerfile:./services/watchers/Dockerfile name:watchers]) (push) Successful in 2m35s
/ deploy (push) Successful in 16s
This commit is contained in:
parent
e40b939144
commit
096314c14c
1 changed files with 0 additions and 54 deletions
|
@ -1,54 +0,0 @@
|
||||||
const async = require("async")
|
|
||||||
|
|
||||||
const { gql } = require("@apollo/client/core")
|
|
||||||
const { ctx } = require("@modjo/core")
|
|
||||||
// const watcherCtx = require("modjo-plugins/core/ctx/watcher")
|
|
||||||
// const tasks = require("~/tasks")
|
|
||||||
|
|
||||||
const ALERT_FOLLOW_LOCATION_SUBSCRIPTION = gql`
|
|
||||||
subscription onAlertFollowLocation($limit: Int) {
|
|
||||||
selectManyAlert(
|
|
||||||
where: { _and: { state: { _eq: "open" }, followLocation: { _eq: true } } }
|
|
||||||
limit: $limit
|
|
||||||
order_by: { id: asc }
|
|
||||||
) {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
|
|
||||||
module.exports = async function () {
|
|
||||||
const logger = ctx.require("logger")
|
|
||||||
const apolloClient = ctx.require("apolloClient")
|
|
||||||
// const { addTask } = ctx.require("amqp")
|
|
||||||
|
|
||||||
// const QUEUE_BATCH_SIZE = null
|
|
||||||
const QUEUE_BATCH_SIZE = 1000
|
|
||||||
|
|
||||||
return async function alertTableFollowLocation() {
|
|
||||||
logger.info("watcher alertTableFollowLocation: daemon started")
|
|
||||||
|
|
||||||
const observable = apolloClient.subscribe({
|
|
||||||
query: ALERT_FOLLOW_LOCATION_SUBSCRIPTION,
|
|
||||||
variables: {
|
|
||||||
limit: QUEUE_BATCH_SIZE,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
observable.subscribe({
|
|
||||||
next: async ({ data }) => {
|
|
||||||
const { selectManyAlert } = data
|
|
||||||
await async.eachOf(selectManyAlert, async ({ id: _id }) => {
|
|
||||||
// TODO
|
|
||||||
})
|
|
||||||
},
|
|
||||||
error: (error) => {
|
|
||||||
logger.error(
|
|
||||||
{ error, watcher: "alertTableFollowLocation" },
|
|
||||||
`subscription error`
|
|
||||||
)
|
|
||||||
throw error
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue