mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-23 23:06:06 +08:00
20 lines
519 B
TypeScript
20 lines
519 B
TypeScript
import { ServerUnaryCall, sendUnaryData } from '@grpc/grpc-js';
|
|
import { DeleteCronRequest, DeleteCronResponse } from '../protos/cron';
|
|
import { scheduleStacks } from './data';
|
|
|
|
const delCron = (
|
|
call: ServerUnaryCall<DeleteCronRequest, DeleteCronResponse>,
|
|
callback: sendUnaryData<DeleteCronResponse>,
|
|
) => {
|
|
for (const id of call.request.ids) {
|
|
if (scheduleStacks.has(id)) {
|
|
scheduleStacks.get(id)?.cancel();
|
|
scheduleStacks.delete(id);
|
|
}
|
|
}
|
|
|
|
callback(null, null);
|
|
};
|
|
|
|
export { delCron };
|