2020-10-12 10:17:40 +00:00
|
|
|
package alphabet
|
|
|
|
|
|
|
|
import (
|
2024-10-21 07:22:54 +00:00
|
|
|
"context"
|
|
|
|
|
2023-04-12 14:35:10 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
2023-05-26 10:24:41 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/processors"
|
2023-03-07 13:38:26 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/timers"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event"
|
2020-10-12 10:17:40 +00:00
|
|
|
"go.uber.org/zap"
|
|
|
|
)
|
|
|
|
|
2024-10-21 13:27:28 +00:00
|
|
|
func (ap *Processor) HandleGasEmission(ctx context.Context, ev event.Event) {
|
2020-10-12 10:17:40 +00:00
|
|
|
_ = ev.(timers.NewAlphabetEmitTick)
|
2024-10-21 13:27:28 +00:00
|
|
|
ap.log.Info(ctx, logs.AlphabetTick, zap.String("type", "alphabet gas emit"))
|
2020-10-12 10:17:40 +00:00
|
|
|
|
|
|
|
// send event to the worker pool
|
|
|
|
|
2024-10-21 13:27:28 +00:00
|
|
|
err := processors.SubmitEvent(ap.pool, ap.metrics, "alphabet_emit_gas", func() bool { return ap.processEmit(ctx) })
|
2020-10-12 10:17:40 +00:00
|
|
|
if err != nil {
|
|
|
|
// there system can be moved into controlled degradation stage
|
2024-10-21 13:27:28 +00:00
|
|
|
ap.log.Warn(ctx, logs.AlphabetAlphabetProcessorWorkerPoolDrained,
|
2021-09-08 08:28:41 +00:00
|
|
|
zap.Int("capacity", ap.pool.Cap()))
|
2020-10-12 10:17:40 +00:00
|
|
|
}
|
|
|
|
}
|