mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-03 11:25:29 -04:00
Delete the single job push method
This commit is contained in:
parent
c39a1ddbaf
commit
fa50f4cb88
@ -73,18 +73,6 @@ module MangaDex
|
|||||||
return job
|
return job
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def push(job)
|
|
||||||
begin
|
|
||||||
DB.open "sqlite3://#{@path}" do |db|
|
|
||||||
db.exec "insert into queue values (?, ?, ?, ?, ?, ?, ?)",
|
|
||||||
job.id, job.manga_id, job.title, job.manga_title,
|
|
||||||
job.status.to_i, job.log, job.time.to_unix
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
rescue
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
# Push an array of jobs into the queue, and return the number of jobs
|
# Push an array of jobs into the queue, and return the number of jobs
|
||||||
# inserted. Any job already exists in the queue will be ignored.
|
# inserted. Any job already exists in the queue will be ignored.
|
||||||
def push(jobs : Array(Job))
|
def push(jobs : Array(Job))
|
||||||
@ -99,26 +87,6 @@ module MangaDex
|
|||||||
end
|
end
|
||||||
self.count - start_count
|
self.count - start_count
|
||||||
end
|
end
|
||||||
#def push(job)
|
|
||||||
#sucess = false
|
|
||||||
#DB.open "sqlite3://#{@path}" do |db|
|
|
||||||
#trans = db.begin_transaction
|
|
||||||
#con = trans.connection
|
|
||||||
#begin
|
|
||||||
#con.exec "insert into queue values (?, ?, ?, ?, ?, ?, ?)",
|
|
||||||
#job.id, job.manga_id, job.title, job.manga_title,
|
|
||||||
#job.status.to_i, job.log, job.time.to_unix
|
|
||||||
#rescue
|
|
||||||
#trans.rollback
|
|
||||||
#else
|
|
||||||
#trans.commit
|
|
||||||
#success = true
|
|
||||||
#end
|
|
||||||
#con.close
|
|
||||||
#trans.close
|
|
||||||
#end
|
|
||||||
#success
|
|
||||||
#end
|
|
||||||
def delete(id)
|
def delete(id)
|
||||||
DB.open "sqlite3://#{@path}" do |db|
|
DB.open "sqlite3://#{@path}" do |db|
|
||||||
db.exec "delete from queue where id = (?)", id
|
db.exec "delete from queue where id = (?)", id
|
||||||
|
Loading…
x
Reference in New Issue
Block a user