Replace unstable try_trait with a job_try! macro

This commit is contained in:
Alexander Krotov
2019-12-27 11:14:05 +01:00
parent fe2011742d
commit 83c98c2d55
3 changed files with 26 additions and 33 deletions

View File

@@ -640,11 +640,11 @@ pub fn JobMaybeSendLocationsEnded(context: &Context, job: &mut Job) -> Try {
let chat_id = job.foreign_id;
let (send_begin, send_until) = context.sql.query_row(
let (send_begin, send_until) = job_try!(context.sql.query_row(
"SELECT locations_send_begin, locations_send_until FROM chats WHERE id=?",
params![chat_id as i32],
|row| Ok((row.get::<_, i64>(0)?, row.get::<_, i64>(1)?)),
)?;
));
if !(send_begin != 0 && time() <= send_until) {
// still streaming -
@@ -652,10 +652,10 @@ pub fn JobMaybeSendLocationsEnded(context: &Context, job: &mut Job) -> Try {
// do not un-schedule pending DC_MAYBE_SEND_LOC_ENDED jobs
if !(send_begin == 0 && send_until == 0) {
// not streaming, device-message already sent
context.sql.execute(
job_try!(context.sql.execute(
"UPDATE chats SET locations_send_begin=0, locations_send_until=0 WHERE id=?",
params![chat_id as i32],
)?;
));
let stock_str = context.stock_system_msg(StockMessage::MsgLocationDisabled, "", "", 0);
chat::add_info_msg(context, chat_id, stock_str);