Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Name of task class cannot be in CamelCase format when using lock #19

Closed
ErnaniR opened this issue Aug 11, 2021 · 1 comment
Closed

Name of task class cannot be in CamelCase format when using lock #19

ErnaniR opened this issue Aug 11, 2021 · 1 comment

Comments

@ErnaniR
Copy link

ErnaniR commented Aug 11, 2021

Description

I'm getting a strange bug. If I create a task and enable the lock, but the class name is in camel case, an error is thrown. It seems there is an erroneous conversion of class name into lock file name.
For example, here is the same task from the explanation video in the docs, but the name is TaskToCheckSomething instead of Test:

import Logger from '@ioc:Adonis/Core/Logger'
import { BaseTask } from 'adonis5-scheduler/build'

export default class TaskToCheckSomething extends BaseTask {
  public static get schedule() {
    return '*/1 * * * * *'
  }

  public static get useLock() {
    return true
  }

  public async handle() {
    const ms = new Date().getTime()
    Logger.info('handle start', ms)
    await new Promise((resolve) => setTimeout(resolve, 3000))
    Logger.info('handle end', ms)
  }
}

This will throw an invalid argument error, as it is trying to create a lock file with the name \tmpLock\task:to:check:something.lock'.
If I change the class name to Tasktochecksomething the error does not occur.

Package version

2.0.2

Error Message & Stack Trace

Start the program with node ace serve --watch in the console and:

[1628704860016] FATAL (project-name/19356 on DESKTOP-XXXXX): "uncaughtException" detected. Process will shutdown
Error: EINVAL: invalid argument, mkdir 'C:\Path\to\project\project-name\tmpLock\task:to:check:something.lock'
[ warn ]  Underlying HTTP server died with "1 code"

Relevant Information

Adonis 5.1.0

@reg2005
Copy link
Owner

reg2005 commented Oct 24, 2023

Fixed, please upgrade package

@reg2005 reg2005 closed this as completed Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants