Skip to content

Commit

Permalink
ndb: fix source view counting
Browse files Browse the repository at this point in the history
  • Loading branch information
pkulev committed Dec 24, 2023
1 parent 020b793 commit f1c32e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pyroute2/ndb/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@ def __init__(self, ndb, **spec):
self.ndb.task_manager.db_add_nl_source(self.target, self.kind, spec)
self.load_sql()

@classmethod
def _count(cls, view):
return view.ndb.task_manager.db_fetchone(
"SELECT count(*) FROM %s" % view.table
)

@property
def must_restart(self):
if self.max_errors < 0 or self.errors_counter <= self.max_errors:
Expand Down
1 change: 1 addition & 0 deletions tests/test_linux/test_ndb/test_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def test_multiple_sources(context):
assert len(list(ndb.neighbours.dump()))
assert len(list(ndb.addresses.dump()))
assert len(list(ndb.routes.dump()))
assert len(ndb.sources) == len(sources)
# here NDB() gets closed
#

Expand Down

0 comments on commit f1c32e5

Please sign in to comment.