mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
Limit pool summary aggregate refresh window
This commit is contained in:
@@ -20,7 +20,7 @@ export class PoolSummaryContinuousAggregate1781400000000 implements MigrationInt
|
|||||||
await queryRunner.query(`
|
await queryRunner.query(`
|
||||||
SELECT add_continuous_aggregate_policy(
|
SELECT add_continuous_aggregate_policy(
|
||||||
'accepted_share_pool_10m',
|
'accepted_share_pool_10m',
|
||||||
start_offset => INTERVAL '2 days',
|
start_offset => INTERVAL '25 hours',
|
||||||
end_offset => INTERVAL '1 minute',
|
end_offset => INTERVAL '1 minute',
|
||||||
schedule_interval => INTERVAL '1 minute',
|
schedule_interval => INTERVAL '1 minute',
|
||||||
if_not_exists => TRUE
|
if_not_exists => TRUE
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||||||
|
|
||||||
|
export class PoolSummaryRefreshWindow1781401000000 implements MigrationInterface {
|
||||||
|
public name = 'PoolSummaryRefreshWindow1781401000000';
|
||||||
|
public transaction = false;
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`
|
||||||
|
SELECT remove_continuous_aggregate_policy(
|
||||||
|
'accepted_share_pool_10m',
|
||||||
|
if_exists => TRUE
|
||||||
|
)
|
||||||
|
`);
|
||||||
|
await queryRunner.query(`
|
||||||
|
SELECT add_continuous_aggregate_policy(
|
||||||
|
'accepted_share_pool_10m',
|
||||||
|
start_offset => INTERVAL '25 hours',
|
||||||
|
end_offset => INTERVAL '1 minute',
|
||||||
|
schedule_interval => INTERVAL '1 minute',
|
||||||
|
if_not_exists => TRUE
|
||||||
|
)
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`
|
||||||
|
SELECT remove_continuous_aggregate_policy(
|
||||||
|
'accepted_share_pool_10m',
|
||||||
|
if_exists => TRUE
|
||||||
|
)
|
||||||
|
`);
|
||||||
|
await queryRunner.query(`
|
||||||
|
SELECT add_continuous_aggregate_policy(
|
||||||
|
'accepted_share_pool_10m',
|
||||||
|
start_offset => INTERVAL '2 days',
|
||||||
|
end_offset => INTERVAL '1 minute',
|
||||||
|
schedule_interval => INTERVAL '1 minute',
|
||||||
|
if_not_exists => TRUE
|
||||||
|
)
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@ import { ShareRollupStoragePolicy1781305000000 } from './ORM/_migrations/ShareRo
|
|||||||
import { AcceptedShareHighScores1781309000000 } from './ORM/_migrations/AcceptedShareHighScores1781309000000';
|
import { AcceptedShareHighScores1781309000000 } from './ORM/_migrations/AcceptedShareHighScores1781309000000';
|
||||||
import { UserAgentReportNonzeroHashrate1781313000000 } from './ORM/_migrations/UserAgentReportNonzeroHashrate1781313000000';
|
import { UserAgentReportNonzeroHashrate1781313000000 } from './ORM/_migrations/UserAgentReportNonzeroHashrate1781313000000';
|
||||||
import { PoolSummaryContinuousAggregate1781400000000 } from './ORM/_migrations/PoolSummaryContinuousAggregate1781400000000';
|
import { PoolSummaryContinuousAggregate1781400000000 } from './ORM/_migrations/PoolSummaryContinuousAggregate1781400000000';
|
||||||
|
import { PoolSummaryRefreshWindow1781401000000 } from './ORM/_migrations/PoolSummaryRefreshWindow1781401000000';
|
||||||
import { UserAgentReportView } from './ORM/_views/user-agent-report/user-agent-report.view';
|
import { UserAgentReportView } from './ORM/_views/user-agent-report/user-agent-report.view';
|
||||||
import { AcceptedShareEntity } from './ORM/accepted-share/accepted-share.entity';
|
import { AcceptedShareEntity } from './ORM/accepted-share/accepted-share.entity';
|
||||||
import { AddressSettingsEntity } from './ORM/address-settings/address-settings.entity';
|
import { AddressSettingsEntity } from './ORM/address-settings/address-settings.entity';
|
||||||
@@ -64,6 +65,7 @@ export const databaseMigrations = [
|
|||||||
AcceptedShareHighScores1781309000000,
|
AcceptedShareHighScores1781309000000,
|
||||||
UserAgentReportNonzeroHashrate1781313000000,
|
UserAgentReportNonzeroHashrate1781313000000,
|
||||||
PoolSummaryContinuousAggregate1781400000000,
|
PoolSummaryContinuousAggregate1781400000000,
|
||||||
|
PoolSummaryRefreshWindow1781401000000,
|
||||||
];
|
];
|
||||||
|
|
||||||
export function createDatabaseOptions(env: NodeJS.ProcessEnv): TypeOrmModuleOptions & DataSourceOptions {
|
export function createDatabaseOptions(env: NodeJS.ProcessEnv): TypeOrmModuleOptions & DataSourceOptions {
|
||||||
|
|||||||
Reference in New Issue
Block a user