Compare commits

...

3 Commits

Author SHA1 Message Date
semantic-release-bot 8993ba67d4 chore(release): 0.1.0-develop.64 [skip ci]
# [0.1.0-develop.64](https://git.lumeweb.com/LumeWeb/libethsync/compare/v0.1.0-develop.63...v0.1.0-develop.64) (2023-10-29)

### Bug Fixes

* wrap sync in try/catch and unlock mutex in a finally ([0963794](09637948e7))
2023-10-29 01:59:29 +00:00
Derrick Hammer fd3d5facac
Merge remote-tracking branch 'origin/develop' into develop 2023-10-28 21:58:38 -04:00
Derrick Hammer 09637948e7
fix: wrap sync in try/catch and unlock mutex in a finally 2023-10-28 21:57:59 -04:00
4 changed files with 24 additions and 13 deletions

View File

@ -1,3 +1,10 @@
# [0.1.0-develop.64](https://git.lumeweb.com/LumeWeb/libethsync/compare/v0.1.0-develop.63...v0.1.0-develop.64) (2023-10-29)
### Bug Fixes
* wrap sync in try/catch and unlock mutex in a finally ([0963794](https://git.lumeweb.com/LumeWeb/libethsync/commit/09637948e71e88c66b9e40389b4a46c60659f6e3))
# [0.1.0-develop.63](https://git.lumeweb.com/LumeWeb/libethsync/compare/v0.1.0-develop.62...v0.1.0-develop.63) (2023-10-24)

4
npm-shrinkwrap.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@lumeweb/libethsync",
"version": "0.1.0-develop.63",
"version": "0.1.0-develop.64",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@lumeweb/libethsync",
"version": "0.1.0-develop.63",
"version": "0.1.0-develop.64",
"dependencies": {
"@chainsafe/as-sha256": "^0.3.1",
"@chainsafe/bls": "7.1.1",

View File

@ -1,6 +1,6 @@
{
"name": "@lumeweb/libethsync",
"version": "0.1.0-develop.63",
"version": "0.1.0-develop.64",
"type": "module",
"repository": {
"type": "git",

View File

@ -170,18 +170,22 @@ export default abstract class BaseClient extends EventEmitter {
protected async _sync() {
await this.syncMutex.acquire();
const currentPeriod = this.getCurrentPeriod();
if (currentPeriod > this._latestPeriod) {
if (!this.booted) {
this.latestCommittee = await this.syncFromGenesis();
} else {
this.latestCommittee = await this.syncFromLastUpdate();
try {
const currentPeriod = this.getCurrentPeriod();
if (currentPeriod > this._latestPeriod) {
if (!this.booted) {
this.latestCommittee = await this.syncFromGenesis();
} else {
this.latestCommittee = await this.syncFromLastUpdate();
}
this._latestPeriod = currentPeriod;
this.emit("synced");
}
this._latestPeriod = currentPeriod;
this.emit("synced");
} catch (e) {
console.log(e);
} finally {
this.syncMutex.release();
}
this.syncMutex.release();
}
protected async subscribe(callback?: (ei: ExecutionInfo) => void) {