Skip to content

Commit

Permalink
Use new core selfPatch features (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
alewitt2 authored Sep 25, 2019
1 parent 5bf7199 commit 7f7cb9d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/FeatureFlagSetLDController.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ module.exports = class FeatureFlagSetLDController extends BaseController {
},
data: variation.allValues()
};
let cont = await this.patchSelf(patchObject);
if (!cont) return;
let res = await this.patchSelf(patchObject);
objectPath.set(this.data, 'object', res); // save latest patch response

if (!objectPath.get(clients, [sdkkey, 'watching'], false)) {
client.on('update', async () => {
Expand Down Expand Up @@ -195,6 +195,17 @@ module.exports = class FeatureFlagSetLDController extends BaseController {
objectPath.set(clients, [this._sdkkey, 'connections', this.namespace, this.name, cmName], wm);
}

dataToHash(resource) {
// Override if you have other data as important.
// Changes to these sections allow modify event to proceed.
return {
labels: objectPath.get(resource, 'metadata.labels'),
spec: objectPath.get(resource, 'spec'),
FeatureFlagUpdateReceived: objectPath.get(resource, 'status.FeatureFlagUpdateReceived'),
IdentityUpdateReceived: objectPath.get(resource, 'status.IdentityUpdateReceived')
};
}

async finalizerCleanup() {
let key = objectPath.get(this.data, ['object', 'spec', 'sdk-key']);

Expand Down

0 comments on commit 7f7cb9d

Please sign in to comment.