chore: adjust timing
This commit is contained in:
		
							parent
							
								
									dab5a115cf
								
							
						
					
					
						commit
						07aba6d14a
					
				
							
								
								
									
										4
									
								
								feed.go
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								feed.go
									
									
									
									
									
								
							@ -243,7 +243,7 @@ func storeFeed(ctx context.Context, db db, f types.TwtFile) error {
 | 
				
			|||||||
			continue
 | 
								continue
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		nick = strings.TrimSpace(nick)
 | 
							nick = strings.TrimSpace(nick)
 | 
				
			||||||
		uri = "http" + strings.TrimSpace(uri)
 | 
							uri = strings.TrimSpace(uri)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if _, err := url.Parse(uri); err != nil {
 | 
							if _, err := url.Parse(uri); err != nil {
 | 
				
			||||||
			continue
 | 
								continue
 | 
				
			||||||
@ -285,8 +285,8 @@ func storeFeed(ctx context.Context, db db, f types.TwtFile) error {
 | 
				
			|||||||
			feedID,                  // feed_id
 | 
								feedID,                  // feed_id
 | 
				
			||||||
			twtID,                   // ulid
 | 
								twtID,                   // ulid
 | 
				
			||||||
			fmt.Sprintf("%+l", twt), // text
 | 
								fmt.Sprintf("%+l", twt), // text
 | 
				
			||||||
			subjectTag,              // conv
 | 
					 | 
				
			||||||
			twt.Hash(),              // hash
 | 
								twt.Hash(),              // hash
 | 
				
			||||||
 | 
								subjectTag,              // conv
 | 
				
			||||||
			mentions.ToStrList(),    // mentions
 | 
								mentions.ToStrList(),    // mentions
 | 
				
			||||||
			tags,                    // tags
 | 
								tags,                    // tags
 | 
				
			||||||
		)
 | 
							)
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										6
									
								
								http.go
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								http.go
									
									
									
									
									
								
							@ -210,12 +210,12 @@ func httpServer(ctx context.Context, app *appState) error {
 | 
				
			|||||||
		preamble = add(preamble, iAmTheWatcher)
 | 
							preamble = add(preamble, iAmTheWatcher)
 | 
				
			||||||
		preamble = add(preamble, "")
 | 
							preamble = add(preamble, "")
 | 
				
			||||||
		preamble = add(preamble, "range = 1  %d", end)
 | 
							preamble = add(preamble, "range = 1  %d", end)
 | 
				
			||||||
		preamble = add(preamble, "self = /api/plain/twts%s", mkqry(uri, limit, offset))
 | 
							preamble = add(preamble, "self = /api/plain/twt%s", mkqry(uri, limit, offset))
 | 
				
			||||||
		if next := offset + int64(len(twts)); next < end {
 | 
							if next := offset + int64(len(twts)); next < end {
 | 
				
			||||||
			preamble = add(preamble, "next = /api/plain/twts%s", mkqry(uri, limit, next))
 | 
								preamble = add(preamble, "next = /api/plain/twt%s", mkqry(uri, limit, next))
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if prev := offset - int64(limit); prev > 0 {
 | 
							if prev := offset - int64(limit); prev > 0 {
 | 
				
			||||||
			preamble = add(preamble, "prev = /api/plain/twts%s", mkqry(uri, limit, prev))
 | 
								preamble = add(preamble, "prev = /api/plain/twt%s", mkqry(uri, limit, prev))
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		reg := lextwt.NewTwtRegistry(preamble, twts)
 | 
							reg := lextwt.NewTwtRegistry(preamble, twts)
 | 
				
			||||||
 | 
				
			|||||||
@ -229,31 +229,31 @@ func checkTemp(twts types.Twts) (int, State) {
 | 
				
			|||||||
	since_first := -time.Until(twts[0].Created())
 | 
						since_first := -time.Until(twts[0].Created())
 | 
				
			||||||
	since_fifth := -time.Until(twts[4].Created())
 | 
						since_fifth := -time.Until(twts[4].Created())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if since_first < 2*time.Hour || since_fifth < 8*time.Hour {
 | 
						if since_first < 24*time.Hour || since_fifth < 32*time.Hour {
 | 
				
			||||||
		return TwoMinutes, "hot"
 | 
							return TwoMinutes, "hot"
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if since_first < 4*time.Hour || since_fifth < 16*time.Hour {
 | 
						if since_first < 48*time.Hour || since_fifth < 64*time.Hour {
 | 
				
			||||||
		return TenMinutes, "hot"
 | 
							return TenMinutes, "hot"
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if since_first < 8*time.Hour || since_fifth < 32*time.Hour {
 | 
						if since_first < 96*time.Hour || since_fifth < 128*time.Hour {
 | 
				
			||||||
		return 2 * TenMinutes, "warm"
 | 
							return 2 * TenMinutes, "warm"
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if since_first < 16*time.Hour || since_fifth < 64*time.Hour {
 | 
						if since_first < 192*time.Hour || since_fifth < 256*time.Hour {
 | 
				
			||||||
		return 4 * TenMinutes, "warm"
 | 
							return 4 * TenMinutes, "warm"
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if since_first < 24*time.Hour || since_fifth < 128*time.Hour {
 | 
						if since_first < 384*time.Hour || since_fifth < 512*time.Hour {
 | 
				
			||||||
		return OneDay, "cold"
 | 
							return OneDay, "cold"
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if since_first < 48*time.Hour || since_fifth < 256*time.Hour {
 | 
						if since_first < 768*time.Hour || since_fifth < 1024*time.Hour {
 | 
				
			||||||
		return 2 * OneDay, "cold"
 | 
							return 2 * OneDay, "cold"
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if since_first < 96*time.Hour || since_fifth < 512*time.Hour {
 | 
						if since_first < 1536*time.Hour || since_fifth < 2048*time.Hour {
 | 
				
			||||||
		return 7 * OneDay, "frozen"
 | 
							return 7 * OneDay, "frozen"
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user