New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add changes stream syncer #970

Merged
merged 2 commits into from Jun 25, 2016

Conversation

Projects
None yet
4 participants
@fengmk2
Member

fengmk2 commented Jun 25, 2016

fix scope package missing problem

close #908

@fengmk2 fengmk2 added the feat label Jun 25, 2016

@fengmk2 fengmk2 added this to the 2.x milestone Jun 25, 2016

@mention-bot

This comment has been minimized.

mention-bot commented Jun 25, 2016

By analyzing the blame information on this pull request, we identified @dead-horse to be a potential reviewer

@fengmk2 fengmk2 force-pushed the chagne-stream-syncer branch from e406d16 to 5c57cf7 Jun 25, 2016

@fengmk2

This comment has been minimized.

Member

fengmk2 commented Jun 25, 2016

image

@codecov-io

This comment has been minimized.

codecov-io commented Jun 25, 2016

Current coverage is 88.47%

Merging #970 into master will decrease coverage by 0.16%

@@             master       #970   diff @@
==========================================
  Files            85         85          
  Lines          3291       3296     +5   
  Methods         340        340          
  Messages          0          0          
  Branches        613        615     +2   
==========================================
- Hits           2917       2916     -1   
- Misses          374        380     +6   
  Partials          0          0          

Sunburst

Powered by Codecov. Last updated by ee1e084...2c18f6e

@fengmk2 fengmk2 force-pushed the chagne-stream-syncer branch 3 times, most recently from bda8ca2 to f71e847 Jun 25, 2016

@@ -209,6 +197,10 @@ var config = {
// sync devDependencies or not, default is false
syncDevDependencies: false,
// changes streaming sync
changesStreamingSync: false,

This comment has been minimized.

@fengmk2

fengmk2 Jun 25, 2016

Member

只需要在内网开启 changesStreamingSync ,并且设置 handleSyncRegistry 为 tnpm registry 即可。

urllib.request(url, {
method: 'PUT',
dataType: 'json',
timeout: 10000,

This comment has been minimized.

@dead-horse

dead-horse Jun 25, 2016

Member

这个接口只同步这个模块,不会同步他的依赖吧? 10s 够么?

This comment has been minimized.

@fengmk2

fengmk2 Jun 25, 2016

Member

只是调用一下创建同步任务,不关心是否真正同步成功。即使失败,原来的定时同步在10分钟后也会确保同步成功。

This comment has been minimized.

@dead-horse

dead-horse Jun 25, 2016

Member

记起来了,查询是否成功日志的接口是另外的

syncPackage(change);
setTimeout(() => {
syncPackage(change);
}, 5000)

This comment has been minimized.

@dead-horse

dead-horse Jun 25, 2016

Member

分号, setTimeout 写一行吧

if (config.changesStreamingSync) {
const sync = require('./changes_stream_syncer');
let syncing = false;
const syncFn = co.wrap(function* syncPopular() {

This comment has been minimized.

@dead-horse

dead-horse Jun 25, 2016

Member

syncChangeStream

sendMailToAdmin(error, data, new Date());
if (sync) {
// the same time only sync once
var syncing = false;

This comment has been minimized.

@dead-horse

dead-horse Jun 25, 2016

Member

var 都改成 let 吧,下面也有一个 syncing ,看的容易混

feat: add changes stream syncer
fix scope package missing problem

close #908

@fengmk2 fengmk2 force-pushed the chagne-stream-syncer branch from f71e847 to 95c7a33 Jun 25, 2016

@fengmk2

This comment has been minimized.

Member

fengmk2 commented Jun 25, 2016

@dead-horse 都改了

@dead-horse dead-horse merged commit 6485e4b into master Jun 25, 2016

2 of 4 checks passed

Node Security 3 vulnerabilities found
Details
codecov/project 88.47% (-0.17%) compared to ee1e084
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@dead-horse dead-horse deleted the chagne-stream-syncer branch Jun 25, 2016

@dead-horse

This comment has been minimized.

Member

dead-horse commented Jun 25, 2016

+1

@dead-horse

This comment has been minimized.

Member

dead-horse commented Jun 25, 2016

2.11.0

@fengmk2

This comment has been minimized.

Member

fengmk2 commented Jun 25, 2016

哈哈,马上被捕获到

image

@fengmk2

This comment has been minimized.

Member

fengmk2 commented Jun 25, 2016

'2.11.0': '2016-06-25T13:07:08.649Z', 1s 之后被实时同步


  [2016-06-25 21:07:09.492][12064] Get change: {"seq":2615175,"id":"cnpmjs.org","changes":[{"rev":"293-837113a82174791d334fe1980a4296f8"}]} +6s
  [2016-06-25 21:07:09.526][12064] 2615175:cnpmjs.org sync request sent, log: 
@dead-horse

This comment has been minimized.

Member

dead-horse commented Jun 25, 2016

发布之后不需要手动执行 tnpm sync 了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment