waitnotice

package
v0.217.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package waitnotice tells a person, once, that something entered the 「等我」 list, and reminds them once more if it stays there. It is the only sender of the 「等我」 notices: the desktop, webhook and Web Push channels all hang off Sender, so they cannot disagree.

The scan compares the current list with the waiting_notices rows and stamps the row where it sends, so a restart repeats nothing and skips nothing. A notice carries a title and a category, never the text of a turn.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Title

func Title(lang i18n.Lang, n Notice) string

Title is the one line every channel shows for n: "<name> is waiting for your answer". It is built from the name and the category only; nothing a turn said can reach it.

Types

type Notice

type Notice struct {
	Subject
	Reminder bool
}

Notice is one thing to send. Reminder marks the second and last notice of a stay.

type Scanner

type Scanner struct {
	Store         Store
	Source        Source
	Sender        Sender
	ReminderAfter func() time.Duration
	Now           func() time.Time
	// contains filtered or unexported fields
}

Scanner runs the comparison. ReminderAfter is read on every pass (0 = no reminder) so a config reload applies to the next one.

func (*Scanner) Sweep

func (s *Scanner) Sweep() error

Sweep makes one pass. A failing source ends the pass before anything is written: a list that could not be read says nothing about who left it.

type Sender

type Sender interface {
	Send(Notice)
}

Sender delivers one notice on every channel. It must not block.

type Source

type Source interface {
	Waiting() ([]Subject, error)
}

Source answers what waits for a person right now.

type Store

type Store interface {
	ListOpenWaitingNotices() ([]jobstore.WaitingNotice, error)
	EnterWaitingNotice(caller, subjectKey, category string, at int64) (jobstore.WaitingNotice, bool, error)
	MarkWaitingNotified(id, at int64) error
	MarkWaitingReminded(id, at int64) error
	ClearWaitingNotice(id, at int64) error
	WaitingNoticesInitialized() (bool, error)
	MarkWaitingNoticesInitialized(at int64) error
}

Store is the part of the job store the scan keeps its record in.

type Subject

type Subject struct {
	// Key is the subject key ("session:<id>", "job:<id>"); it is also the Web Push tag.
	Key string
	// Category is the 「等我」 category id (answer, approval ...).
	Category string
	// CallerID is the owner the notice goes to ("" = every caller that sees the project).
	CallerID   string
	ProjectKey string
	// Title is what the person knows the subject by: the seat name, the session title or the
	// job title.
	Title string
	// ThreadID is the workbench thread the notice opens ("r:<sid>" for a terminal session).
	ThreadID string
}

Subject is one entry of the 「等我」 list that a person is told about.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL