Skip to content

Commit

Permalink
add experimental ttl and lifetime for ipns record. may change in the …
Browse files Browse the repository at this point in the history
…future
  • Loading branch information
Rinse12 committed Dec 11, 2023
1 parent f509223 commit 2d87a3e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/subplebbit/subplebbit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -796,9 +796,14 @@ export class Subplebbit extends TypedEmitter<SubplebbitEvents> implements Omit<S
await this._unpinStaleCids();
const file = await this._clientsManager.getDefaultIpfs()._client.add(deterministicStringify(this._rawSubplebbitType));
this._cidsToUnPin = [file.path];
// If this._isSubRunningLocally = false, then this is the last publish before stopping
const ttl = this._isSubRunningLocally ? `${this.plebbit.publishInterval * 3}ms` : undefined;
const lifetime = this._isSubRunningLocally ? `${this.plebbit.publishInterval * 1000}ms` : `24h`;
const publishRes = await this._clientsManager.getDefaultIpfs()._client.name.publish(file.path, {
key: this.signer.ipnsKeyName,
allowOffline: true
allowOffline: true,
ttl,
lifetime
});
this.emit("update", this);
log(
Expand Down

0 comments on commit 2d87a3e

Please sign in to comment.