Skip to content

Commit d9003b3

Browse files
committed
Only process a maximum of 10 releases per update in order to keep the number of open file descriptors lower.
1 parent 22b9e1e commit d9003b3

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/hook.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ function processVersions( repo, fn ) {
4949

5050
return tags.filter(function( tag ) {
5151
return !(tag in processedTags);
52-
});
52+
// only process up to 10 tags per run
53+
// this keeps the number of open file descriptors lower
54+
// it's unlikely that any update will have more than 10 tags
55+
}).slice( -10 );
5356
},
5457

5558
// get releases
@@ -84,7 +87,6 @@ function processVersions( repo, fn ) {
8487
return true;
8588
}
8689

87-
// TODO: gracefully handle duplicates in case of retry
8890
// track invalid tags so we don't process them on each update
8991
pluginsDb.addTag( repo.getId(), tags[ i ], invalidGroup() );
9092
return false;

src/pluginsdb.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ var pluginsDb = module.exports = {
8484
}),
8585

8686
addTag: auto(function( repoId, tag, fn ) {
87-
db.run( "INSERT INTO repos( repo, tag ) VALUES( ?, ? )", [ repoId, tag ], fn );
87+
db.run( "INSERT OR IGNORE INTO repos( repo, tag ) VALUES( ?, ? )", [ repoId, tag ], fn );
8888
}),
8989

9090
addRelease: auto(function( repoId, release, fn ) {
@@ -166,7 +166,8 @@ var pluginsDb = module.exports = {
166166

167167
db.run( "CREATE TABLE repos (" +
168168
"repo TEXT, " +
169-
"tag TEXT" +
169+
"tag TEXT, " +
170+
"PRIMARY KEY( repo, tag ) " +
170171
")", this.parallel() );
171172

172173
db.run( "CREATE TABLE actions (" +

0 commit comments

Comments
 (0)