Skip to content

Commit

Permalink
refactor: code directory
Browse files Browse the repository at this point in the history
  • Loading branch information
chhabra1112 committed Jan 23, 2025
1 parent 5d3c1fe commit e74fe53
Show file tree
Hide file tree
Showing 16 changed files with 8 additions and 59 deletions.
53 changes: 0 additions & 53 deletions lib/limiter/explorer.ts

This file was deleted.

3 changes: 3 additions & 0 deletions packages/core/lib/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import { GenericFunction } from './interfaces';
import { JOB_NAME, JOB_OPTIONS } from './queue/constants';
import { QueueMetadata } from './queue/metadata';
import { Injectable } from './foundation';
import { REFILL_INTERVAL, TOKEN_COUNT } from './limiter/constants';
import { ulid } from 'ulid';
import { Limiter } from './limiter';

@Injectable()
export class IntentExplorer {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LimiterDriver } from '../interfaces/LimiterDriver';
import { LimiterDriver } from '../interfaces/limiterDriver';

export class MemoryDriver implements LimiterDriver {
private static keyCounts = {};
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import { LimiterDriver } from './interfaces/limiterDriver';
import { BaseStrategy } from './strategies/baseStrategy';
import { Injectable } from '@nestjs/common';
import { RedisDriver } from './drivers/redis';
import { IntentConfig } from '../config/service';
import { ConfigService } from '../config/service';
import {
DriversMap,
LimiterDriverType,
LimiterOptions,
} from './interfaces/options';

@Injectable()
export class Limiter {
private static driver: LimiterDriver;
private static strategy: BaseStrategy;
constructor(private config: IntentConfig) {
const options = this.config.get<LimiterOptions>('queue');
constructor(private config: ConfigService) {
const options = this.config.get('limiter');
if(!options) return
switch (options.driver) {
case LimiterDriverType.REDIS: {
Limiter.driver = new DriversMap[LimiterDriverType.REDIS](
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit e74fe53

Please sign in to comment.