#11681 closed enhancement (fixed)
Cache env.get_version
Reported by: | anonymous | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | low | Milestone: | 0.12.6 |
Component: | general | Version: | 1.0.1 |
Severity: | trivial | Keywords: | cache get_version timeline ticket environment |
Cc: | Branch: | ||
Release Notes: |
The value of |
||
API Changes: |
Added |
||
Internal Changes: |
Description
When viewing the timeline, for each ticket it finds it request env.get_version which runs a sql-query:
SELECT value FROM system WHERE name='initial_database_version'
Couldn't this info be cached somewhere instead? (maybe inside the get_version function?) it seems highly unlikely the value will change…
I know the DB probably will have the query in its cache and its a tiny query, but its still unnecessary to ask over and over again
Reference: http://trac.edgewall.org/browser/tags/trac-1.0.1/trac/ticket/web_ui.py#L130 http://trac.edgewall.org/browser/tags/trac-1.0.1/trac/env.py#L586
Attachments (0)
Change History (9)
comment:1 by , 10 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
follow-up: 3 comment:2 by , 10 years ago
Proposed changes in log:rjollos.git:t11681.
We might consider:
- Renamed
Environment.version
→Environment.database_version
- Renamed
Environment.initial_version
→Environment.database_initial_version
That is because the Environment has a version as well: trunk/trac/env.py@12843:47#L45.
I haven't checked the issue on 0.12-stable, but we could fix it there too if it's important.
comment:3 by , 10 years ago
Keywords: | environment added; env.get_version removed |
---|
Replying to rjollos:
Proposed changes in log:rjollos.git:t11681.
In [92db8fb6f/rjollos.git], I think Environment.version
should return new version after upgrade_environment
.
We might consider:
- Renamed
Environment.version
→Environment.database_version
- Renamed
Environment.initial_version
→Environment.database_initial_version
That is because the Environment has a version as well: trunk/trac/env.py@12843:47#L45.
Agreed. I think that's good naming.
I haven't checked the issue on 0.12-stable, but we could fix it there too if it's important.
0.12-stable has the same issue. Also, preventing the query is to set [ticket] preserve_newlines
to enabled
or disabled
.
comment:5 by , 10 years ago
Revised changes in log:rjollos.git:t11681.1, and for 0.12 in log:rjollos.git:t11681_0.12.
comment:6 by , 10 years ago
API Changes: | modified (diff) |
---|---|
Milestone: | 1.0.2 → 0.12.6 |
Release Notes: | modified (diff) |
Resolution: | → fixed |
Status: | assigned → closed |
Fix for 0.12-stable committed in [12985] (record-only merges in [12986:12987]). Fix for 1.0-stable committed in [12989], merged in [12990].
comment:7 by , 10 years ago
API Changes: | modified (diff) |
---|
follow-up: 9 comment:8 by , 10 years ago
comment:9 by , 10 years ago
Replying to rjollos:
Removed use of deprecated
get_version
inEnvironmentStub
class in [13643]. Merged to trunk in [13644].
Environment.database_version
is lazily-evaluated, so the database may not be reset in tearDown
if the database version is changed in the test case. Fixed on 1.0-stable in [13921], on trunk in [13923].
Yes, we can fix it with some property caching.