Skip to content

Commit

Permalink
Merge pull request #82 from Chia-Network/develop
Browse files Browse the repository at this point in the history
Release 1.7.5
  • Loading branch information
TheLastCicada authored Feb 15, 2024
2 parents f6cbf48 + beeeb61 commit 5a792ac
Show file tree
Hide file tree
Showing 20 changed files with 381 additions and 231 deletions.
198 changes: 106 additions & 92 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "core-registry-cadt",
"version": "1.7.4",
"version": "1.7.5",
"_comment": "DONT CHANGE MAJOR UNLESS DATAMODEL CHANGES: The major version corresponds to the datamodel version your using, so 2.0.0 means it'll use datamodel v2",
"private": true,
"bin": "build/server.js",
Expand Down Expand Up @@ -67,15 +67,15 @@
"@babel/plugin-syntax-import-attributes": "^7.23.3",
"@babel/preset-env": "^7.23.9",
"@babel/register": "^7.23.7",
"@commitlint/cli": "18.4.4",
"@commitlint/cli": "18.6.0",
"@commitlint/config-conventional": "^18.6.0",
"babel-plugin-module-resolver": "^5.0.0",
"chai": "4.4.1",
"chai": "5.1.0",
"chai-http": "^4.4.0",
"eslint": "^8.56.0",
"eslint-plugin-es": "^4.1.0",
"eslint-plugin-mocha": "^10.2.0",
"husky": "^8.0.3",
"husky": "^9.0.10",
"mocha": "^10.3.0",
"semver": "^7.6.0",
"sinon": "^17.0.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';

export default {
async up(queryInterface, Sequelize) {
await Promise.all(
['audit'].map((table) => {
queryInterface.addColumn(table, 'generation', {
type: Sequelize.INTEGER,
allowNull: true,
});
}),
);
},

async down(queryInterface) {
await Promise.all(
['audit'].map((table) => {
queryInterface.removeColumn(table, 'generation');
}),
);
},
};
5 changes: 5 additions & 0 deletions src/database/migrations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import AddPrefix from './20230824175347-add-prefix';
import OrgSyncStatus from './20231020201652-OrgSyncStatus';
import OrgSyncRemaining from './20231020214357-OrgSyncRemainingCount';
import UnitOwnerNotRequired from './20231016190739-UnitOwnerNotRequired';
import AddGenerationIndexToAudit from './20231207142225-AddGenerationIndexToAudit';

export const migrations = [
{
Expand Down Expand Up @@ -184,4 +185,8 @@ export const migrations = [
migration: UnitOwnerNotRequired,
name: '20231016190739-UnitOwnerNotRequired',
},
{
migration: AddGenerationIndexToAudit,
name: '20231207142225-AddGenerationIndexToAudit',
},
];
6 changes: 5 additions & 1 deletion src/datalayer/writeService.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ const createDataLayerStore = async () => {

if (shouldMirror) {
const mirrorUrl = await getMirrorUrl();
await dataLayer.addMirror(storeId, mirrorUrl, true);
if (mirrorUrl) {
await dataLayer.addMirror(storeId, mirrorUrl, true);
} else {
logger.error('Mirror URL not available, skipping mirror announcement.');
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/models/audit/audit.modeltypes.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,7 @@ module.exports = {
type: Sequelize.DATE,
defaultValue: Sequelize.NOW,
},
generation: {
type: Sequelize.INTEGER,
},
};
2 changes: 2 additions & 0 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Server } from 'socket.io';
import { connection } from './websocket';
import { CONFIG } from './user-config';
import { logger } from './logger.js';
import { getMirrorUrl } from './utils/datalayer-utils';

import dotenv from 'dotenv';

Expand All @@ -23,6 +24,7 @@ server.on('listening', onListening);

server.listen(port, bindAddress, () => {
console.log(`Server listening at http://${bindAddress}:${port}`);
console.log(`Mirror URL: ${getMirrorUrl()}`);
});

const io = new Server(server);
Expand Down
12 changes: 9 additions & 3 deletions src/tasks/mirror-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,15 @@ const runMirrorCheck = async () => {
const orgData = organizations[org];
const mirrorUrl = await getMirrorUrl();

// There is logic within the addMirror function to check if the mirror already exists
await Organization.addMirror(orgData.orgUid, mirrorUrl);
await Organization.addMirror(orgData.registryId, mirrorUrl);
if (mirrorUrl) {
// There is logic within the addMirror function to check if the mirror already exists
await Organization.addMirror(orgData.orgUid, mirrorUrl);
await Organization.addMirror(orgData.registryId, mirrorUrl);
} else {
logger.error(
'Mirror URL is not available, skipping mirror announcement',
);
}
}
}
};
Expand Down
Loading

0 comments on commit 5a792ac

Please sign in to comment.