Skip to content

Commit

Permalink
fix: remove node module uri prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
calebboyd committed Jan 9, 2023
1 parent a790382 commit 4c809d2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
9 changes: 7 additions & 2 deletions src/stream.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { hostname } from 'node:os'
import { hostname } from 'os'
import { ack, createClient, initStreams, readAckDelete } from './redis.js'
import type {
RedisStreamOptions,
Expand All @@ -8,7 +8,7 @@ import type {
StreamEntry,
} from './types.js'

export { RedisStreamOptions }
export { RedisStreamOptions, RedisClient, RedisOptions } from './types'

const allowedKeys = {
stream: 1,
Expand Down Expand Up @@ -268,6 +268,11 @@ export class RedisStream {
await this.maybeUnblock()
}

/**
* Flush any acknowledgements that were added potentially after the stream finished.
* @param client
* @returns
*/
public async flush(client?: RedisClient) {
if (!this.pendingAcks.size) return
let c = client
Expand Down
2 changes: 1 addition & 1 deletion src/test.util.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { RedisClient, StreamEntry, XEntryResult } from './types.js'
import { afterAll } from 'vitest'
import mkDebug from 'debug'
import { randomInt } from 'node:crypto'
import { randomInt } from 'crypto'
import Chance from 'chance'

const seed = Number(process.env.TEST_SEED) || randomInt(Date.now())
Expand Down
7 changes: 4 additions & 3 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export type XEntryBufferResult = [StreamKey, StreamEntryKeyValueBuffers]
export type XStreamResultBuffer = [StreamKey, StreamEntryKeyValueBuffers[]]
export type XBatchResultBuffer = XStreamResult[]

export { Redis as RedisClient }
export type RedisClient = Redis
export { RedisOptions }

export class RedisStreamAbortedError extends Error {
message = 'RedisStream Aborted with unprocessed results'
Expand Down Expand Up @@ -51,13 +52,13 @@ export interface RedisStreamOptions {
* The IORedis client connection (reader).
* NOTE: by default this connection becomes a "reader" when block > 0
*/
redis?: Redis | string | RedisOptions
redis?: RedisClient | string | RedisOptions
/**
* The IORedis control client connection (writer).
* NOTE: by default this connection becomes a "writer" when block = 0 or Infinity
* Only allowed if block = 0 or Infinity
*/
redisControl?: Redis | string | RedisOptions
redisControl?: RedisClient | string | RedisOptions
/**
* Return buffers with each xread operation
* This applies to entry id and kv results
Expand Down

0 comments on commit 4c809d2

Please sign in to comment.