Commit bd693d2
committed
Speed up startup by improving optimizing database opening
Do not open all shards for a SymbolIndex if we want to just get the
binary dir of it.
* bdx/cli.py (guess_index_path_for_directory): Do not open the
SymbolIndex, instead call the new static `get_binary_dir' function to
try to get the binary directory for the index at given path.
* bdx/index.py (DB_SUBDIR): New helper var.
(SymbolIndex.open): Use it.
(SymbolIndex.open_shard): Use it and remove the `readonly' argument as
shards should only be used for writing.
(SymbolIndex.get_binary_dir): New staticmethod.1 parent d7a46ef commit bd693d2
2 files changed
+27
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
112 | 109 | | |
113 | 110 | | |
114 | 111 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
507 | 507 | | |
508 | 508 | | |
509 | 509 | | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
510 | 513 | | |
511 | 514 | | |
512 | 515 | | |
| |||
644 | 647 | | |
645 | 648 | | |
646 | 649 | | |
647 | | - | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
648 | 653 | | |
649 | 654 | | |
650 | 655 | | |
| |||
655 | 660 | | |
656 | 661 | | |
657 | 662 | | |
658 | | - | |
659 | | - | |
660 | | - | |
| 663 | + | |
661 | 664 | | |
662 | | - | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
663 | 668 | | |
664 | | - | |
| 669 | + | |
665 | 670 | | |
666 | 671 | | |
667 | 672 | | |
| |||
681 | 686 | | |
682 | 687 | | |
683 | 688 | | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
684 | 699 | | |
685 | 700 | | |
686 | 701 | | |
| |||
0 commit comments