profile
viewpoint

themez/texas-holdem-house 6

A texas hold'em game engine for bot players

iftechio/koa 1

Expressive middleware for node.js using ES2017 async functions

iftechio/node-cache-manager-redis 1

Node cache store for Redis

themez/node-wait 1

Provide a function to block js thread for given time.

iftechio/dynogels 0

DynamoDB data mapper for node.js. Originally forked from https://github.com/ryanfitz/vogels

themez/docker-register 0

Service registration for docker containers

themez/flink 0

Apache Flink

themez/knockdown 0

Github flavored Markdown for SublimeText and a custom theme for writing markdown

startedSmirkCao/Lihang

started time in 6 days

startedAllenDowney/ThinkComplexity2

started time in 10 days

PR closed request/request

Fix connreset retry

PR Checklist:

  • [x] I have run npm test locally and all tests are passing.
  • [ ] I have added/updated tests for any new behavior. <!-- Request is a complex project, there are VERY FEW exceptions where a new test is not required for new behavior. -->
  • [ ] If this is a significant change, an issue has already been created where the problem / solution was discussed: [N/A, or add link to issue here]

PR Description

Fixes #3131

+2 -2

0 comment

1 changed file

themez

pr closed time in 18 days

startedhehonghui/the-economist-ebooks

started time in 23 days

starteddavidmarkclements/0x

started time in a month

startediwoods100/wxapi-doc

started time in a month

startedRenzHoly/Mongood

started time in a month

startedronami/meta-typing

started time in a month

delete branch themez/sentry-go

delete branch : fix-scope-request-body

delete time in a month

PR opened getsentry/sentry-go

fix: clone request body to new scope

The problem

I apply sentryecho middleware to my echo application, when capturing exception in withScope, the request body was not recorded.

Fix

Assign clone's request body to original scope

+3 -0

0 comment

2 changed files

pr created time in a month

push eventthemez/sentry-go

themez

commit sha c0fcf775978ed158b8930c071d251562eac2dd42

fix: clone requestbody to new scope

view details

push time in a month

create barnchthemez/sentry-go

branch : fix/scope-request-body

created branch time in a month

create barnchthemez/sentry-go

branch : fix-scope-request-body

created branch time in a month

fork themez/sentry-go

Official Sentry SDK for Go

fork in a month

startedbcicen/grmon

started time in a month

startedroam-unofficial/awesome-roam

started time in 2 months

Pull request review commentiftechio/sqs-messenger

AMQP support

 export class MnsClient implements Client {     return { MessageId: data.MessageId, MD5OfMessageBody: data.MessageBodyMD5 }   } }++export class AmqpClient implements Client {+  channel: amqplib.Channel++  constructor(options: amqplib.Options.Connect) {+    amqplib+      .connect(options)+      .then(connection => connection.createChannel().then(channel => (this.channel = channel)))+  }++  async createQueue(params: { QueueName: string }) {+    await this.channel.assertQueue(params.QueueName)+    return { Locator: params.QueueName }+  }++  async sendMessage(params: { Locator: string; MessageBody: string }) {+    this.channel.sendToQueue(params.Locator, Buffer.from(params.MessageBody))+    return {}+  }++  async sendMessageBatch(params: {+    Locator: string+    Entries: {+      MessageBody: string+    }[]+  }) {+    await Bluebird.map(+      params.Entries,+      entry => this.channel.sendToQueue(params.Locator, Buffer.from(entry.MessageBody)),+      { concurrency: 5 },+    )+  }++  async receiveMessageBatch(params: { Locator: string }) {+    const data = await this.channel.get(params.Locator)++    return {+      Messages: data+        ? [+            {+              MessageId: data.properties.messageId,+              ReceiptHandle: JSON.stringify(data),

这里需要是整个data吗,你用的node库这样设计接口是不是只是为了方便调用,实际可能只需要一个messageId?

devlkx

comment created time in 2 months

Pull request review commentiftechio/sqs-messenger

AMQP support

 export class MnsClient implements Client {     return { MessageId: data.MessageId, MD5OfMessageBody: data.MessageBodyMD5 }   } }++export class AmqpClient implements Client {+  channel: amqplib.Channel++  constructor(options: amqplib.Options.Connect) {+    amqplib+      .connect(options)+      .then(connection => connection.createChannel().then(channel => (this.channel = channel)))

异步的初始化不要放在constructor里,因为constructor是无法await的,后面调用channel相关的方法都有可能碰到channel还没初始化的情况。 可以创建一个getChannel方法,所有使用channel的地方检查channel是否初始化,否则等待promise完成。

devlkx

comment created time in 2 months

PR closed oakserver/oak

make it safe to extend and use context type in middleware

According to #21.

By this patch, middleware got ability to extend context type, for example from Context<{}> to Context<{user: {id: string}}>, which can be safely used in followed-up middleware or router handler.

const app = new Application()
  .use((ctx: Context<{ user: { id: string } }>, next) => {
    ctx.state.user.id = ctx.request.headers.get("uid");
  })
  .use((ctx: Context<{ user: { name: string } }>, next) => {
    // safe to access ctx.state.user.id now
    ctx.state.user.name = Users.get(ctx.state.user.id);
    return next();
  });
const router = app.createRouter();
router.get("/logout", context => {
  // ctx's type generated from all previous application middlewares
  ctx.response.body = `user ${ctx.state.user.name}(${ctx.state.user.id}) logged out`;
});

Breaking change need to be aware of: app.use takes only one middleware parameter now.

P.S. I also think it would be better to have router.use API(middleware which only apply to router prefix paths). But might need some change on route matching process.

+80 -91

2 comments

3 changed files

themez

pr closed time in 3 months

more