Skip to content

RTD delay and first RTD does not trigger any event calculate #124

@ShieldTrade

Description

@ShieldTrade

xloil 0.18.7
Excel 64

I experience a delay in pyclock ( random from 50 to 150 mls ) and, when the first yield is received in excel, the event calculate is not fired. Following yields normally trigger the event calculate.

sheet1
G10 = pyclock (10)
for cell G11 and G12 change format and use custom format hh.mm:ss.000

sheet 2
C10 = Sheet1!G11+Sheet1!G12+1

Save, close, reopen and press F9.

This is part of a more difficult issue that I am trying to debug where the event calculate triggers a macro ( I use VBA ) which copies the data received in another sheet of the same workbook. It works fine for a random time ( usually from 5 to 24 hrs ) then excel crashes and nothing is printed in the xloil log. The task manager does not show any problem for memory and cpu usage. Before copying I disable events and set calculation to manual. I suppose a thread conflict is the cause but I do not see any in my code. I am deconstructing and testing small part of it.


import xloil, datetime, asyncio
import pandas as pd

@xlo.func
async def pyclock (secs):
    while True:
        data_df = { 'time': [], 'event': [] }
        time = datetime.datetime.now()
        data_df['time'].append(time)
        data_df['event'].append('data received')
        data_df['time'].append(time)
        data_df['event'].append('data received')
        df = pd.DataFrame(data_df)
        df = df.set_index('time')
        yield df
        await asyncio.sleep(secs)`

VBA code in sheet 2
Option Explicit
Private Sub Worksheet_Calculate()
     MsgBox "  calculate sheet 2"
End Sub

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions