mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 13:02:24 -05:00 
			
		
		
		
	[feature] Run initial cache cleanup on gotosocial start in case max-age changed (#533)
Signed-off-by: kim <grufwub@gmail.com>
This commit is contained in:
		
					parent
					
						
							
								b28fd7433a
							
						
					
				
			
			
				commit
				
					
						e09958e7f1
					
				
			
		
					 1 changed files with 5 additions and 2 deletions
				
			
		|  | @ -109,7 +109,6 @@ type manager struct { | ||||||
| // For a 4 core machine, this will be 2 workers, and a queue length of 20. | // For a 4 core machine, this will be 2 workers, and a queue length of 20. | ||||||
| // For a single or 2-core machine, the media manager will get 1 worker, and a queue of length 10. | // For a single or 2-core machine, the media manager will get 1 worker, and a queue of length 10. | ||||||
| func NewManager(database db.DB, storage *kv.KVStore) (Manager, error) { | func NewManager(database db.DB, storage *kv.KVStore) (Manager, error) { | ||||||
| 
 |  | ||||||
| 	// configure the worker pool | 	// configure the worker pool | ||||||
| 	// make sure we always have at least 1 worker even on single-core machines | 	// make sure we always have at least 1 worker even on single-core machines | ||||||
| 	numWorkers := runtime.NumCPU() / 2 | 	numWorkers := runtime.NumCPU() / 2 | ||||||
|  | @ -176,9 +175,13 @@ func NewManager(database db.DB, storage *kv.KVStore) (Manager, error) { | ||||||
| 			return nil | 			return nil | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  | 		// Run an initial cache prune in case max age changed | ||||||
|  | 		logrus.Infof("media manager: running initial remote cache cleanup") | ||||||
|  | 		go pruneFunc() | ||||||
|  | 
 | ||||||
| 		// now start all the cron stuff we've lined up | 		// now start all the cron stuff we've lined up | ||||||
| 		c.Start() | 		c.Start() | ||||||
| 		logrus.Infof("started media manager remote cache cleanup job: will run next at %s", c.Entry(entryID).Next) | 		logrus.Infof("media manager: next scheduled remote cache cleanup is %q", c.Entry(entryID).Next) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	return m, nil | 	return m, nil | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue