Retry HTTP requests
This commit is contained in:
parent
86b1345c17
commit
d7c13b975f
24 changed files with 145 additions and 93 deletions
|
@ -1,7 +1,7 @@
|
|||
import * as bodyParser from 'body-parser';
|
||||
import * as express from 'express';
|
||||
import { parseRequest } from 'http-signature';
|
||||
import queue from '../../queue';
|
||||
import { createHttp } from '../../queue';
|
||||
|
||||
const app = express();
|
||||
|
||||
|
@ -22,7 +22,7 @@ app.post('/@:user/inbox', bodyParser.json({
|
|||
return res.sendStatus(401);
|
||||
}
|
||||
|
||||
queue.create('http', {
|
||||
createHttp({
|
||||
type: 'processInbox',
|
||||
inbox: req.body,
|
||||
signature,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
import $ from 'cafy';
|
||||
import User from '../../../../models/user';
|
||||
import Following from '../../../../models/following';
|
||||
import queue from '../../../../queue';
|
||||
import { createHttp } from '../../../../queue';
|
||||
|
||||
/**
|
||||
* Follow a user
|
||||
|
@ -56,7 +56,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
|||
followeeId: followee._id
|
||||
});
|
||||
|
||||
queue.create('http', { type: 'follow', following: _id }).save();
|
||||
createHttp({ type: 'follow', following: _id }).save();
|
||||
|
||||
// Send response
|
||||
res();
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
import $ from 'cafy';
|
||||
import User from '../../../../models/user';
|
||||
import Following from '../../../../models/following';
|
||||
import queue from '../../../../queue';
|
||||
import { createHttp } from '../../../../queue';
|
||||
|
||||
/**
|
||||
* Unfollow a user
|
||||
|
@ -49,7 +49,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
|||
return rej('already not following');
|
||||
}
|
||||
|
||||
queue.create('http', {
|
||||
createHttp({
|
||||
type: 'unfollow',
|
||||
id: exist._id
|
||||
}).save(error => {
|
||||
|
|
|
@ -3,7 +3,7 @@ import * as express from 'express';
|
|||
//const crypto = require('crypto');
|
||||
import User from '../../../models/user';
|
||||
import config from '../../../config';
|
||||
import queue from '../../../queue';
|
||||
import { createHttp } from '../../../queue';
|
||||
|
||||
module.exports = async (app: express.Application) => {
|
||||
if (config.github_bot == null) return;
|
||||
|
@ -42,7 +42,7 @@ module.exports = async (app: express.Application) => {
|
|||
const commit = event.commit;
|
||||
const parent = commit.parents[0];
|
||||
|
||||
queue.create('http', {
|
||||
createHttp({
|
||||
type: 'gitHubFailureReport',
|
||||
userId: bot._id,
|
||||
parentUrl: parent.url,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue