Skip to content

Commit ab9d982

Browse files
committed
Update to use connectionDetails.objectsGCGracePeriod
The field was renamed server-side to better reflect that this is specifically for LiveObjects
1 parent ac372f0 commit ab9d982

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/plugins/objects/defaults.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export const DEFAULTS = {
22
gcInterval: 1000 * 60 * 5, // 5 minutes
33
/**
4-
* The SDK will attempt to use the `gcGracePeriod` value provided by the server in the `connectionDetails` object of the `CONNECTED` event.
4+
* The SDK will attempt to use the `objectsGCGracePeriod` value provided by the server in the `connectionDetails` object of the `CONNECTED` event.
55
* If the server does not provide this value, the SDK will fall back to this default value.
66
*
77
* Must be > 2 minutes to ensure we keep tombstones long enough to avoid the possibility of receiving an operation

src/plugins/objects/objects.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ export class Objects {
6565
this._objectsPool = new ObjectsPool(this);
6666
this._syncObjectsDataPool = new SyncObjectsDataPool(this);
6767
this._bufferedObjectOperations = [];
68-
// use server-provided gcGracePeriod if available, and subscribe to new connectionDetails that can be emitted as part of the RTN24
69-
this.gcGracePeriod = this._channel.connectionManager.connectionDetails?.gcGracePeriod ?? DEFAULTS.gcGracePeriod;
68+
// use server-provided objectsGCGracePeriod if available, and subscribe to new connectionDetails that can be emitted as part of the RTN24
69+
this.gcGracePeriod = this._channel.connectionManager.connectionDetails?.objectsGCGracePeriod ?? DEFAULTS.gcGracePeriod;
7070
this._channel.connectionManager.on('connectiondetails', (details: Record<string, any>) => {
71-
this.gcGracePeriod = details.gcGracePeriod ?? DEFAULTS.gcGracePeriod;
71+
this.gcGracePeriod = details.objectsGCGracePeriod ?? DEFAULTS.gcGracePeriod;
7272
});
7373
}
7474

test/realtime/objects.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4234,7 +4234,7 @@ define(['ably', 'shared_helper', 'chai', 'objects', 'objects_helper'], function
42344234
}, client);
42354235
});
42364236

4237-
it('gcGracePeriod is set from connectionDetails', async function () {
4237+
it('gcGracePeriod is set from connectionDetails.objectsGCGracePeriod', async function () {
42384238
const helper = this.test.helper;
42394239
const client = RealtimeWithObjects(helper);
42404240

@@ -4248,11 +4248,11 @@ define(['ably', 'shared_helper', 'chai', 'objects', 'objects_helper'], function
42484248

42494249
// gcGracePeriod should be set after the initial connection
42504250
helper.recordPrivateApi('read.Objects.gcGracePeriod');
4251-
expect(objects.gcGracePeriod, 'Check gcGracePeriod is set after initial connection').to.exist;
4251+
expect(objects.gcGracePeriod, 'Check gcGracePeriod is set after initial connection from connectionDetails.objectsGCGracePeriod').to.exist;
42524252
helper.recordPrivateApi('read.Objects.gcGracePeriod');
42534253
expect(objects.gcGracePeriod).to.equal(
4254-
connectionDetails.gcGracePeriod,
4255-
'Check gcGracePeriod is set to equal connectionDetails.gcGracePeriod',
4254+
connectionDetails.objectsGCGracePeriod,
4255+
'Check gcGracePeriod is set to equal connectionDetails.objectsGCGracePeriod',
42564256
);
42574257

42584258
const connectionDetailsPromise = connectionManager.once('connectiondetails');
@@ -4265,7 +4265,7 @@ define(['ably', 'shared_helper', 'chai', 'objects', 'objects_helper'], function
42654265
action: 4, // CONNECTED
42664266
connectionDetails: {
42674267
...connectionDetails,
4268-
gcGracePeriod: 999,
4268+
objectsGCGracePeriod: 999,
42694269
},
42704270
}),
42714271
);

0 commit comments

Comments
 (0)