Skip to content

Add in-memory storage mode (default) and storage option; update README#6

Merged
QuenumGerald merged 3 commits into
mainfrom
enregistrer-les-taches-en-ram
Apr 10, 2026
Merged

Add in-memory storage mode (default) and storage option; update README#6
QuenumGerald merged 3 commits into
mainfrom
enregistrer-les-taches-en-ram

Conversation

@QuenumGerald

Copy link
Copy Markdown
Owner

Motivation

  • Make the scheduler run in RAM by default to simplify local usage and avoid implicit file persistence.
  • Provide an explicit storage option to allow choosing between in-memory and SQLite-backed persistence.
  • Document the default behavior and how to enable SQLite persistence in the README (French additions).

Description

  • Add storage?: 'sqlite' | 'memory' to BlazeJobOptions and make dbPath optional, and derive dbPath from storage with :memory: used for memory mode.
  • Initialize SQLite database path inside the constructor using const useMemoryStorage = options.storage !== 'sqlite' and call new Database(dbPath) accordingly.
  • Change server bootstrap in startServer to create jobs = new BlazeJob({ storage: 'memory' }) by default and reuse the scheduler's DB instance via db = jobs['db'] instead of creating a separate Database('blazerjob.db') instance.
  • Preserve existing table creation and schema migration logic; keep encryption key helper behavior and encryption/decryption helpers intact while making dbPath optional.
  • Update README.md with examples showing the default RAM mode and how to enable SQLite persistence, with code snippets in TypeScript and French explanatory text.

Testing

  • Built the TypeScript project with tsc and the build completed successfully.
  • Ran the test suite with npm test and all automated tests passed.
  • Ran linting with npm run lint and it reported no issues.

Codex Task

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 74c9877bf4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/index.ts
Comment on lines +90 to +91
const useMemoryStorage = options.storage !== 'sqlite';
const dbPath = useMemoryStorage ? ':memory:' : (options.dbPath || 'blazerjob.db');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep dbPath-only callers on SQLite storage

The new default const useMemoryStorage = options.storage !== 'sqlite' makes existing new BlazeJob({ dbPath: ... }) callers silently switch to :memory: because storage is usually omitted. In this repo, src/bin/cli.ts still uses dbPath-only construction for schedule, list, and delete, so tasks written by one CLI invocation are no longer visible to the next process, breaking persistence semantics. This is a behavioral regression for existing integrations and should be fixed by inferring SQLite when dbPath is provided unless storage: 'memory' is explicitly set.

Useful? React with 👍 / 👎.

…ly (MAJOR BREAKING CHANGE)

- Remove all Cosmos-related code and dependencies
- Remove unsupported task types (shell, onchain, solana, email, fintech)
- Simplify types to only support HTTP and custom tasks
- Update README to English and remove Cosmos documentation
- Add storage mode documentation (memory vs sqlite)
- Add HTTP server documentation
- Fix WAL mode to only apply to file storage
- Fix memory leaks on task deletion
- Update CLI to use deleteTask method
- Clean up .env.example
- Remove blockchain keyword from package.json
@QuenumGerald QuenumGerald merged commit 46008fa into main Apr 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant