Fix missing search params in rss cache
This commit is contained in:
		
							parent
							
								
									1a9e5a6c72
								
							
						
					
					
						commit
						2a654ea5cd
					
				| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
import asyncdispatch, times, strutils, options, tables
 | 
					import asyncdispatch, times, strutils, tables
 | 
				
			||||||
import redis, redpool, msgpack4nim
 | 
					import redis, redpool, msgpack4nim
 | 
				
			||||||
export redpool, msgpack4nim
 | 
					export redpool, msgpack4nim
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
import asyncdispatch, strutils, tables, times, sequtils
 | 
					import asyncdispatch, strutils, tables, times, sequtils, hashes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import jester
 | 
					import jester
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,7 +7,7 @@ import ".."/[redis_cache, query], ../views/general
 | 
				
			||||||
 | 
					
 | 
				
			||||||
include "../views/rss.nimf"
 | 
					include "../views/rss.nimf"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export times
 | 
					export times, hashes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
proc showRss*(req: Request; hostname: string; query: Query): Future[(string, string)] {.async.} =
 | 
					proc showRss*(req: Request; hostname: string; query: Query): Future[(string, string)] {.async.} =
 | 
				
			||||||
  var profile: Profile
 | 
					  var profile: Profile
 | 
				
			||||||
| 
						 | 
					@ -57,7 +57,7 @@ proc createRssRouter*(cfg: Config) =
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      let
 | 
					      let
 | 
				
			||||||
        cursor = getCursor()
 | 
					        cursor = getCursor()
 | 
				
			||||||
        key = genQueryParam(query) & cursor
 | 
					        key = $hash(genQueryUrl(query)) & cursor
 | 
				
			||||||
        (cRss, cCursor) = await getCachedRss(key)
 | 
					        (cRss, cCursor) = await getCachedRss(key)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if cRss.len > 0:
 | 
					      if cRss.len > 0:
 | 
				
			||||||
| 
						 | 
					@ -97,10 +97,12 @@ proc createRssRouter*(cfg: Config) =
 | 
				
			||||||
        of "search": initQuery(params(request), name=name)
 | 
					        of "search": initQuery(params(request), name=name)
 | 
				
			||||||
        else: Query(fromUser: @[name])
 | 
					        else: Query(fromUser: @[name])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      let
 | 
					      var key = @"name" & "/" & @"tab"
 | 
				
			||||||
        key = @"name" & "/" & @"tab" & getCursor()
 | 
					      if @"tab" == "search":
 | 
				
			||||||
        (cRss, cCursor) = await getCachedRss(key)
 | 
					        key &= hash(genQueryUrl(query))
 | 
				
			||||||
 | 
					      key &= getCursor()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      let (cRss, cCursor) = await getCachedRss(key)
 | 
				
			||||||
      if cRss.len > 0:
 | 
					      if cRss.len > 0:
 | 
				
			||||||
        respRss(cRss, cCursor)
 | 
					        respRss(cRss, cCursor)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue