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

Task not run. #347

Open
minhk551992 opened this issue Oct 21, 2022 · 1 comment
Open

Task not run. #347

minhk551992 opened this issue Oct 21, 2022 · 1 comment

Comments

@minhk551992
Copy link

i try but not working. how to fix?
this my config task
` export const DEFAULT = {
[namespace]: () => {
return {
_toExpand: false,

  // Should this node run a scheduler to promote delayed tasks?
  scheduler: false,

  // what queues should the taskProcessors work?
  queues: ["*"] as string[] | (() => Promise<string[]>),
  // Or, rather than providing a static list of `queues`, you can define a method that returns the list of queues.
  // queues: async () => { return ["queueA", "queueB"]; } as string[] | (() => Promise<string[]>)>,

  // Logging levels of task workers
  workerLogging: {
    failure: "error" as ActionheroLogLevel, // task failure
    success: "info" as ActionheroLogLevel, // task success
    start: "info" as ActionheroLogLevel,
    end: "info" as ActionheroLogLevel,
    cleaning_worker: "info" as ActionheroLogLevel,
    poll: "debug" as ActionheroLogLevel,
    job: "debug" as ActionheroLogLevel,
    pause: "debug" as ActionheroLogLevel,
    reEnqueue: "debug" as ActionheroLogLevel,
    internalError: "error" as ActionheroLogLevel,
    multiWorkerAction: "debug" as ActionheroLogLevel,
  },
  // Logging levels of the task scheduler
  schedulerLogging: {
    start: "info" as ActionheroLogLevel,
    end: "info" as ActionheroLogLevel,
    poll: "debug" as ActionheroLogLevel,
    enqueue: "debug" as ActionheroLogLevel,
    working_timestamp: "debug" as ActionheroLogLevel,
    reEnqueue: "debug" as ActionheroLogLevel,
    transferred_job: "debug" as ActionheroLogLevel,
  },
  // how long to sleep between jobs / scheduler checks
  timeout: 5000,
  // at minimum, how many parallel taskProcessors should this node spawn?
  // (have number > 0 to enable, and < 1 to disable)
  minTaskProcessors: 1,
  // at maximum, how many parallel taskProcessors should this node spawn?
  maxTaskProcessors: 1,
  // how often should we check the event loop to spawn more taskProcessors?
  checkTimeout: 500,
  // how many ms would constitute an event loop delay to halt taskProcessors spawning?
  maxEventLoopDelay: 5,
  // how long before we mark a resque worker / task processor as stuck/dead?
  stuckWorkerTimeout: 1000 * 60 * 60,
  // should the scheduler automatically try to retry failed tasks which were failed due to being 'stuck'?
  retryStuckJobs: false,
  // Customize Resque primitives, replace null with required replacement.
  resque_overrides: {
    queue: null as Queue,
    multiWorker: null as MultiWorker,
    scheduler: null as Scheduler,
  },
  connectionOptions: {
    tasks: {},
  },
};

},
};my Task action import { log, api, Task } from "actionhero";

export class Stats extends Task {
name = "Sync_NhatKyTaiApp_CN0131";
description = "I report the stats";
frequency = 5 * 1000;
queue = "default";

async run() {
log("ádasdas")
// const users = await api.users.list();
// const posts = await api.users.postsList();
// log("*** STATUS ***", "info", {
// users: users.length,
// posts: posts.length,
// });
}
}
`

@evantahler
Copy link
Member

evantahler commented Oct 21, 2022

Can you please update your formatting?

Either way, I think in the config you need scheduler=true

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