| 909 | 'values (?, ?, ?)', params, commit=True) |
| 910 | |
| 911 | def read_schedule(self, ts): |
| 912 | with self.db(commit=True) as curs: |
| 913 | params = (self.name, ts.timestamp()) |
| 914 | curs.execute('select id, data from schedule where ' |
| 915 | 'queue = ? and timestamp <= ?', params) |
| 916 | id_list, data = [], [] |
| 917 | for task_id, task_data in curs.fetchall(): |
| 918 | id_list.append(task_id) |
| 919 | data.append(task_data) |
| 920 | if id_list: |
| 921 | plist = ','.join('?' * len(id_list)) |
| 922 | curs.execute('delete from schedule where id IN (%s)' % plist, |
| 923 | id_list) |
| 924 | return data |
| 925 | |
| 926 | def schedule_size(self): |
| 927 | return self.sql('select count(id) from schedule where queue=?', |