Skip to content

Commit afc19ae

Browse files
committed
chore: misc cleanups and refactoring
1 parent 91b5628 commit afc19ae

20 files changed

+746
-452
lines changed

src/car-blockstore.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { EventEmitter } from 'node:events'
2-
import { createWriteStream, existsSync, type WriteStream } from 'node:fs'
3-
import { mkdir, open } from 'node:fs/promises'
2+
import { createWriteStream, type WriteStream } from 'node:fs'
3+
import { mkdir, open, stat } from 'node:fs/promises'
44
import { dirname } from 'node:path'
55
import { Readable, Transform } from 'node:stream'
66
import { pipeline } from 'node:stream/promises'
@@ -129,7 +129,9 @@ export class CARWritingBlockstore extends EventEmitter implements Blockstore {
129129
await new Promise((resolve) => setTimeout(resolve, 20))
130130

131131
// Verify file was created
132-
if (!existsSync(this.outputPath)) {
132+
try {
133+
await stat(this.outputPath)
134+
} catch {
133135
throw new Error(`Failed to create CAR file at ${this.outputPath}`)
134136
}
135137

src/filecoin-pinning-server.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { Logger } from 'pino'
44
import type { Config } from './config.js'
55
import { FilecoinPinStore, type PinOptions } from './filecoin-pin-store.js'
66
import type { ServiceInfo } from './server.js'
7-
import { initializeSynapse } from './synapse/service.js'
7+
import { setupSynapse } from './synapse/service.js'
88

99
declare module 'fastify' {
1010
interface FastifyRequest {
@@ -25,8 +25,8 @@ export async function createFilecoinPinningServer(
2525
logger: Logger,
2626
serviceInfo: ServiceInfo
2727
): Promise<{ server: FastifyInstance; pinStore: FilecoinPinStore }> {
28-
// Initialize Synapse
29-
const synapseService = await initializeSynapse(config, logger)
28+
// Set up Synapse service
29+
const synapseService = await setupSynapse(config, logger)
3030

3131
// Create our custom Filecoin pin store with Synapse service
3232
const filecoinPinStore = new FilecoinPinStore({

0 commit comments

Comments
 (0)