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

KeyValue.watchall include_history ignored #584

Open
skewty opened this issue Jul 9, 2024 · 1 comment
Open

KeyValue.watchall include_history ignored #584

skewty opened this issue Jul 9, 2024 · 1 comment
Assignees
Labels
defect Suspected defect such as a bug or regression

Comments

@skewty
Copy link

skewty commented Jul 9, 2024

Observed behavior

history values are enumerated regardless of boolean value passed

Expected behavior

history values are enumerated only when boolean value is true

Server and client version

nats-py 2.8.0
nats-server 2.10.17

Host environment

No response

Steps to reproduce

import asyncio
import logging

import nats
from nats.js.api import KeyValueConfig, StorageType
from nats.js.errors import BucketNotFoundError


async def run() -> None:
    nc = await nats.connect("tls://demo.nats.io:4443")
    jc = nc.jetstream()
    try:
        kv = await jc.key_value('nats_test')
    except BucketNotFoundError:
        kv = await jc.create_key_value(KeyValueConfig('nats_test', storage=StorageType.FILE))
    await kv.put('test_key', b'test')
    logger.info("Watching config started")
    include_history = True
    try:
        while True:
            async for entry in await kv.watchall(include_history=include_history, inactive_threshold=2**10):
                logger.info(f"Change for {entry}")
            include_history = False
    except BaseException:
        logger.exception("Error watching config")
        raise
    finally:
        logger.info("Watching config exiting")

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger('nats.testing')
asyncio.run(run())

Also see #580 and #583

@skewty skewty added the defect Suspected defect such as a bug or regression label Jul 9, 2024
@skewty
Copy link
Author

skewty commented Sep 20, 2024

Is there any way to watch a value in the current code base? I tried watch(">") and watchall() and neither stay running. They exit shortly after giving me the value from history.
Kinda renders the feature useless

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Suspected defect such as a bug or regression
Projects
None yet
Development

No branches or pull requests

2 participants