File tree Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -50,9 +50,10 @@ module.exports = {
50
50
return context . commandOptions . revision || ( context . revisionData && context . revisionData . revisionKey ) ;
51
51
} ,
52
52
redisDeployClient : function ( context ) {
53
+ var redisLib = context . _redisLib ;
53
54
var redisOptions = this . pluginConfig ;
54
55
redisOptions . port = this . readConfig ( 'port' ) ;
55
- var redisLib = context . _redisLib ;
56
+ redisOptions . activationSuffix = this . readConfig ( 'activationSuffix' ) ;
56
57
57
58
return new Redis ( redisOptions , redisLib ) ;
58
59
} ,
@@ -135,6 +136,7 @@ module.exports = {
135
136
fetchInitialRevisions : function ( /* context */ ) {
136
137
var redisDeployClient = this . readConfig ( 'redisDeployClient' ) ;
137
138
var keyPrefix = this . readConfig ( 'keyPrefix' ) ;
139
+
138
140
this . log ( 'Listing initial revisions for key: `' + keyPrefix + '`' , { verbose : true } ) ;
139
141
return Promise . resolve ( redisDeployClient . fetchRevisions ( keyPrefix ) )
140
142
. then ( function ( revisions ) {
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ module.exports = CoreObject.extend({
32
32
33
33
this . _maxRecentUploads = options . maxRecentUploads ;
34
34
this . _allowOverwrite = options . allowOverwrite ;
35
+ this . _activationSuffix = options . activationSuffix || 'current' ;
35
36
} ,
36
37
37
38
upload : function ( /*keyPrefix, revisionKey, value*/ ) {
@@ -42,7 +43,6 @@ module.exports = CoreObject.extend({
42
43
var revisionKey = args [ 0 ] || 'default' ;
43
44
var revisionData = args [ 1 ] ;
44
45
var redisKey = keyPrefix + ':' + revisionKey ;
45
-
46
46
var maxEntries = this . _maxRecentUploads ;
47
47
var _this = this ;
48
48
@@ -92,7 +92,7 @@ module.exports = CoreObject.extend({
92
92
} ,
93
93
94
94
activeRevision : function ( keyPrefix ) {
95
- var currentKey = keyPrefix + ':current' ;
95
+ var currentKey = keyPrefix + ':' + this . _activationSuffix ;
96
96
return this . _client . get ( currentKey ) ;
97
97
} ,
98
98
Original file line number Diff line number Diff line change @@ -374,5 +374,21 @@ describe('redis', function() {
374
374
] ) ;
375
375
} ) ;
376
376
} ) ;
377
+
378
+ it ( 'uses activationSuffix in order to get the right activeRevision' , function ( ) {
379
+ var redis = new Redis ( {
380
+ activationSuffix : 'active-key'
381
+ } , new FakeRedis ( FakeClient . extend ( {
382
+ get : function ( key ) {
383
+ return Promise . resolve ( key ) ;
384
+ }
385
+ } ) ) ) ;
386
+
387
+ var promise = redis . activeRevision ( 'key-prefix' ) ;
388
+ return assert . isFulfilled ( promise )
389
+ . then ( function ( result ) {
390
+ assert . equal ( result , 'key-prefix:active-key' ) ;
391
+ } ) ;
392
+ } ) ;
377
393
} ) ;
378
394
} ) ;
You can’t perform that action at this time.
0 commit comments