fix: define cache values
The number of measured values in the cache before they are stored in the database can not be defined over the flag --cached-values.
This commit is contained in:
@ -18,9 +18,7 @@ func InitCmd(cmd *cobra.Command) error {
|
||||
RunE: run,
|
||||
}
|
||||
|
||||
daemonCmd.Flags().Bool("compression", true, "Compress measured values")
|
||||
daemonCmd.Flags().Uint("cached-values", 500, "Number of cached values before saveing into the backend")
|
||||
daemonCmd.Flags().Float64("round", 0.5, "Round values. The value 0 deactivates the function")
|
||||
daemonCmd.Flags().Uint("cached-values", 500, "Number of measured values in the cache before they are stored in the database")
|
||||
cmd.AddCommand(daemonCmd)
|
||||
|
||||
return nil
|
||||
@ -32,6 +30,11 @@ func run(cmd *cobra.Command, args []string) error {
|
||||
return fmt.Errorf("No config file defined: %v", err)
|
||||
}
|
||||
|
||||
cachedEntries, err := cmd.Flags().GetUint("cached-values")
|
||||
if err != nil {
|
||||
return fmt.Errorf("No cached-entries defined")
|
||||
}
|
||||
|
||||
// logLevel, err := cmd.Flags().GetString("loglevel")
|
||||
// if err != nil {
|
||||
// return fmt.Errorf("No loglevel defined: %v", err)
|
||||
@ -44,5 +47,5 @@ func run(cmd *cobra.Command, args []string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
return daemon.Start(cnf, flogger)
|
||||
return daemon.Start(cnf, cachedEntries, flogger)
|
||||
}
|
||||
|
Reference in New Issue
Block a user