mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 19:17:13 -05:00 
			
		
		
		
	register schedule
This commit is contained in:
		
							parent
							
								
									826befc805
								
							
						
					
					
						commit
						8c3ff4fa26
					
				
							
								
								
									
										32
									
								
								src/paperless_mail/migrations/0002_auto_20201117_1334.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								src/paperless_mail/migrations/0002_auto_20201117_1334.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,32 @@
 | 
			
		||||
# Generated by Django 3.1.3 on 2020-11-17 13:34
 | 
			
		||||
 | 
			
		||||
from django.db import migrations
 | 
			
		||||
from django.db.migrations import RunPython
 | 
			
		||||
from django_q.models import Schedule
 | 
			
		||||
from django_q.tasks import schedule
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def add_schedules(apps, schema_editor):
 | 
			
		||||
    schedule('paperless_mail.tasks.process_mail_accounts',
 | 
			
		||||
             name="Check all e-mail accounts",
 | 
			
		||||
             schedule_type=Schedule.MINUTES,
 | 
			
		||||
             minutes=10)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def remove_schedules(apps, schema_editor):
 | 
			
		||||
    Schedule.objects.filter(
 | 
			
		||||
        func='paperless_mail.tasks.process_mail_accounts').delete()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Migration(migrations.Migration):
 | 
			
		||||
 | 
			
		||||
    dependencies = [
 | 
			
		||||
        ('paperless_mail', '0001_initial'),
 | 
			
		||||
        ('django_q', '0013_task_attempt_count'),
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
    operations = [
 | 
			
		||||
        RunPython(add_schedules, remove_schedules)
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user