V: V panic: option size too big

Created on 22 Aug 2019  路  4Comments  路  Source: vlang/v

V version: last
OS: manjaro

What did you do?

import vpervenditti.vgram
bot := vgram.new_bot('TELEGRAM TOKEN', true) // <- set true to see debug log
mut updates := []vgram.Update{}
mut last_offset := 0
for {
    updates = bot.get_updates(vgram.NewGetUpdates{offset: last_offset, limit: 100})
    for update in updates {
        if last_offset < update.update_id {
            last_offset = update.update_id
            match update.message.text {
                '/start' => bot.send_message(vgram.NewSendMessage{
                    chat_id: update.message.from.id.str(),
                    text: 'Hi man'
                })
            }
        }
    }
}

What did you expect to see?
A working chatbot

What did you see instead?
V panic: option size too big: 1520 (max is 255), this is a temporary limit

Bug

Most helpful comment

@medvednikov what's the status on this? This is a serious limitation especially when sending http.Requests and decoding large JSON payloads. Is there a workaround for now?

All 4 comments

When generics are ready option will accept any size of data. For now the limit is used for every option, even if you only need 1 byte. Increasing that limit ATM makes all code using option more inefficient.

Could we workaround this problem? A build option to increase the option limit for v itself, or a hack to make the option smaller?

@medvednikov what's the status on this? This is a serious limitation especially when sending http.Requests and decoding large JSON payloads. Is there a workaround for now?

Fixed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

XVilka picture XVilka  路  3Comments

radare picture radare  路  3Comments

lobotony picture lobotony  路  3Comments

PavelVozenilek picture PavelVozenilek  路  3Comments

cjmxp picture cjmxp  路  3Comments