0%

基本

锁类型

锁兼容: T1 获得了行 r 的共享锁, T2 可以立即获取行 r 的共享锁, 因为读取没有改变行 r 的数据, 这种情况称为锁兼容. 如果是 X 锁, 则必须等待之前的 X 锁或者 S 锁释放, 这种情况称为锁不兼容.

阅读全文 »

前言

一直使用 mysql 做 Apple APNs 队列, 之前使用拖一批出来, 全部处理好取下一批. 中间碰到超时问题, 导致一批很难处理完. 有些 worker 在等超时结束, 导致整个过程 block 住, 即使有些 worker 是空闲的. 即是单入口, 多 worker 的形式. 现在改成多入口, 多 worker 的形式. 每个 worker 先去 DB update 一下, 然后去处理它领取的. 即 update-then-select 模式.

阅读全文 »

前言

在使用 promise.ify 包进行如下操作:

1
2
3
4
5
6
7
const promiseify = require("promise.ify");
const request = require("superagent");
const Request = request.Request;

// 使用 const req = yield req.endAsync();
// 配合 co 使用
Request.prototype.endAsync = promiseify(Request.prototype.end);

进行 n 此 request, 发现每次 url 都是第一次的 url.
promiseify@0.1.0 https://github.com/magicdawn/promise.ify/blob/v0.1.0/index.js#L13

阅读全文 »