Skip to content

Commit

Permalink
default attempts to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
dholms committed Dec 27, 2023
1 parent 4b1b0eb commit 0880d40
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 10 deletions.
1 change: 0 additions & 1 deletion packages/ozone/src/api/admin/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export const getPdsAccountInfo = async (
const res = await agent.api.com.atproto.admin.getAccountInfo({ did }, auth)
return res.data
} catch (err) {
console.log('ERR: ', err)
return null
}
}
Expand Down
7 changes: 4 additions & 3 deletions packages/ozone/src/daemon/event-pusher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { RecordPushEvent } from '../db/schema/record_push_event'
import { BlobPushEvent } from '../db/schema/blob_push_event'
import { dbLogger } from '../logger'
import { InputSchema } from '../lexicon/types/com/atproto/admin/updateSubjectStatus'
import { Selectable } from 'kysely'

type EventSubject = InputSchema['subject']

Expand Down Expand Up @@ -216,7 +217,7 @@ export class EventPusher {
)
}

async attemptRepoEvent(txn: Database, evt: RepoPushEvent) {
async attemptRepoEvent(txn: Database, evt: Selectable<RepoPushEvent>) {
const succeeded = await this.updateSubjectOnAll(
{
$type: 'com.atproto.admin.defs#repoRef',
Expand All @@ -239,7 +240,7 @@ export class EventPusher {
.execute()
}

async attemptRecordEvent(txn: Database, evt: RecordPushEvent) {
async attemptRecordEvent(txn: Database, evt: Selectable<RecordPushEvent>) {
const succeeded = await this.updateSubjectOnAll(
{
$type: 'com.atproto.repo.strongRef',
Expand All @@ -263,7 +264,7 @@ export class EventPusher {
.execute()
}

async attemptBlobEvent(txn: Database, evt: BlobPushEvent) {
async attemptBlobEvent(txn: Database, evt: Selectable<BlobPushEvent>) {
const succeeded = await this.updateSubjectOnAll(
{
$type: 'com.atproto.admin.defs#repoBlobRef',
Expand Down
6 changes: 3 additions & 3 deletions packages/ozone/src/db/migrations/20231219T205730722Z-init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export async function up(db: Kysely<unknown>): Promise<void> {
.addColumn('takedownId', 'integer')
.addColumn('confirmedAt', 'timestamptz')
.addColumn('lastAttempted', 'timestamptz')
.addColumn('attempts', 'integer')
.addColumn('attempts', 'integer', (col) => col.notNull().defaultTo(0))
.addPrimaryKeyConstraint('repo_push_event_pkey', [
'subjectDid',
'eventType',
Expand All @@ -104,7 +104,7 @@ export async function up(db: Kysely<unknown>): Promise<void> {
.addColumn('takedownId', 'integer')
.addColumn('confirmedAt', 'timestamptz')
.addColumn('lastAttempted', 'timestamptz')
.addColumn('attempts', 'integer')
.addColumn('attempts', 'integer', (col) => col.notNull().defaultTo(0))
.addPrimaryKeyConstraint('record_push_event_pkey', [
'subjectUri',
'eventType',
Expand All @@ -125,7 +125,7 @@ export async function up(db: Kysely<unknown>): Promise<void> {
.addColumn('takedownId', 'integer')
.addColumn('confirmedAt', 'timestamptz')
.addColumn('lastAttempted', 'timestamptz')
.addColumn('attempts', 'integer')
.addColumn('attempts', 'integer', (col) => col.notNull().defaultTo(0))
.addPrimaryKeyConstraint('blob_push_event_pkey', [
'subjectDid',
'subjectBlobCid',
Expand Down
4 changes: 3 additions & 1 deletion packages/ozone/src/db/schema/blob_push_event.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Generated } from 'kysely'

export const eventTableName = 'blob_push_event'

export type BlobPushEventType = 'takedown'
Expand All @@ -10,7 +12,7 @@ export interface BlobPushEvent {
takedownId: number | null
confirmedAt: Date | null
lastAttempted: Date | null
attempts: number | null
attempts: Generated<number>
}

export type PartialDB = {
Expand Down
4 changes: 3 additions & 1 deletion packages/ozone/src/db/schema/record_push_event.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Generated } from 'kysely'

export const eventTableName = 'record_push_event'

export type RecordPushEventType = 'takedown'
Expand All @@ -10,7 +12,7 @@ export interface RecordPushEvent {
takedownId: number | null
confirmedAt: Date | null
lastAttempted: Date | null
attempts: number | null
attempts: Generated<number>
}

export type PartialDB = {
Expand Down
4 changes: 3 additions & 1 deletion packages/ozone/src/db/schema/repo_push_event.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Generated } from 'kysely'

export const eventTableName = 'repo_push_event'

export type RepoPushEventType = 'takedown'
Expand All @@ -8,7 +10,7 @@ export interface RepoPushEvent {
takedownId: number | null
confirmedAt: Date | null
lastAttempted: Date | null
attempts: number | null
attempts: Generated<number>
}

export type PartialDB = {
Expand Down

0 comments on commit 0880d40

Please sign in to comment.