Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xloil does not disconnect the initial rtd function call after arguments to the function are modified #99

Open
kousikpandey opened this issue May 15, 2024 · 1 comment

Comments

@kousikpandey
Copy link

kousikpandey commented May 15, 2024

@cunnane thanks for providing us with such a nice library! It enabled us to write excel UDFs / RTD functions with great ease.

I am facing a little issue - please have look and see if you can help me on that. Thanks in advance.

Python 3.12.3 (32 bit)
Windows 10
xloil 0.18.7

xloil does not disconnect the initial rtd function call after arguments to the function are modified.

This happens only for the first call to a function.

for the consequent modifications (with arguments other than the initial one), xloil disconnects those instances successfully.

consider the following rtd function:

@xloil.func(rtd=True)
async def echo_num(num: int):
	while (True):
		yield str(num);
		logging.debug(f"{echo_num.__name__}(\"{num}\"): yielded at {datetime.datetime.now().strftime('%H:%M:%S')}");
		await asyncio.sleep(4.0);

steps to reproduce:

  1. open excel

  2. in any cell write down the following
    =echo_num(100)
    you will see "100" to be displayed in the cell as expected.
    in the log you can see messages coming in with an even interval of 4 seconds

  3. edit the cell to have function argument '200' instead of '100'
    =echo_num(200)

  4. now, you can see log messages for both 100 and 200

  5. edit the cell again to have any other number - say, 300

  6. now, you can see log messages for both 100 and 300
    (the call for argument 200 is successfully deregistered)

  7. edit the cell again to have 100 back as argument

  8. now, you can see log messages for 300 and log messages for 100 in twice the frequency (in every 2 seconds)
    (the call for argument 300 is successfully deregistered - but functions got registered for initial 100, modified 300 and modified 100)

  9. if you keep on repeating the above steps, as many times you modify the cell value to 100 that many number of function call sticks registered which would never get deregistered.

@cunnane
Copy link
Owner

cunnane commented Aug 12, 2024

I can't replicate this with the 64-bit version, I will try the 32-bit version...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants