diff --git a/moonraker/components/file_manager/file_manager.py b/moonraker/components/file_manager/file_manager.py index a4edc50..e001a7c 100644 --- a/moonraker/components/file_manager/file_manager.py +++ b/moonraker/components/file_manager/file_manager.py @@ -535,9 +535,9 @@ class FileManager: started = True if self.queue_gcodes and not started: job_queue: JobQueue = self.server.lookup_component('job_queue') - started = await job_queue.queue_job( + await job_queue.queue_job( upload_info['filename'], check_exists=False) - queued = not started + queued = True await self.notify_sync_lock.wait(300.) self.notify_sync_lock = None diff --git a/moonraker/components/job_queue.py b/moonraker/components/job_queue.py index 9c182a2..63aacee 100644 --- a/moonraker/components/job_queue.py +++ b/moonraker/components/job_queue.py @@ -28,10 +28,10 @@ class JobQueue: def __init__(self, config: ConfigHelper) -> None: self.server = config.get_server() self.queued_jobs: Dict[str, QueuedJob] = {} - self.queue_state: str = "ready" self.lock = asyncio.Lock() self.load_on_start = config.getboolean("load_on_startup", False) self.automatic = config.getboolean("automatic_transition", False) + self.queue_state: str = "ready" if self.automatic else "paused" self.job_delay = config.getfloat("job_transition_delay", 0.01) if self.job_delay <= 0.: raise config.error( @@ -150,31 +150,13 @@ class JobQueue: async def queue_job(self, filename: str, check_exists: bool = True - ) -> bool: + ) -> None: async with self.lock: # Make sure that the file exists if check_exists: self._check_job_file(filename) - can_print = await self._check_can_print() - if ( - self.queue_state == "ready" and - not self.queued_jobs and - can_print - ): - # Printer is ready to accept a print - kapis: KlippyAPI = self.server.lookup_component('klippy_apis') - try: - await kapis.start_print(filename) - except self.server.error: - # Attempt to start print failed, queue the print - pass - else: - return True - if not self.automatic and self.queue_state == "ready": - self.queue_state == "paused" queued_job = QueuedJob(filename) self.queued_jobs[queued_job.job_id] = queued_job - return False async def pause_queue(self) -> None: self.queue_state = "paused"